diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-05-25 09:55:22 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-28 16:53:22 +0200 |
commit | 03b1791cca3e0334637aa232d1f7c11850793646 (patch) | |
tree | 33db9b8db60a592089aaa7a4d6c04f4db4c1860f /apps/files_sharing/tests/ApplicationTest.php | |
parent | 9493f86de34e76e37c13f87aab3123a3efbfdd84 (diff) | |
download | nextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.tar.gz nextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.zip |
Fix share attribute related tests + code style
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/tests/ApplicationTest.php')
-rw-r--r-- | apps/files_sharing/tests/ApplicationTest.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/files_sharing/tests/ApplicationTest.php b/apps/files_sharing/tests/ApplicationTest.php index 3f3164b233e..ee04996ac15 100644 --- a/apps/files_sharing/tests/ApplicationTest.php +++ b/apps/files_sharing/tests/ApplicationTest.php @@ -65,8 +65,7 @@ class ApplicationTest extends TestCase { $this->application = new Application([]); - // FIXME: how to mock this one ?? - $symfonyDispatcher = $this->createMock(SymfonyDispatcher::class); + $symfonyDispatcher = new SymfonyDispatcher(); $this->eventDispatcher = new EventDispatcher( $symfonyDispatcher, $this->createMock(IServerContainer::class), @@ -133,9 +132,9 @@ class ApplicationTest extends TestCase { */ public function testCheckDirectCanBeDownloaded($path, $userFolder, $run) { $user = $this->createMock(IUser::class); - $user->method("getUID")->willReturn("test"); - $this->userSession->method("getUser")->willReturn($user); - $this->userSession->method("isLoggedIn")->willReturn(true); + $user->method('getUID')->willReturn('test'); + $this->userSession->method('getUser')->willReturn($user); + $this->userSession->method('isLoggedIn')->willReturn(true); $this->rootFolder->method('getUserFolder')->willReturn($userFolder); // Simulate direct download of file @@ -210,11 +209,11 @@ class ApplicationTest extends TestCase { */ public function testCheckZipCanBeDownloaded($dir, $files, $userFolder, $run) { $user = $this->createMock(IUser::class); - $user->method("getUID")->willReturn("test"); - $this->userSession->method("getUser")->willReturn($user); - $this->userSession->method("isLoggedIn")->willReturn(true); + $user->method('getUID')->willReturn('test'); + $this->userSession->method('getUser')->willReturn($user); + $this->userSession->method('isLoggedIn')->willReturn(true); - $this->rootFolder->method('getUserFolder')->with("test")->willReturn($userFolder); + $this->rootFolder->method('getUserFolder')->with('test')->willReturn($userFolder); // Simulate zip download of folder folder $event = new GenericEvent(null, ['dir' => $dir, 'files' => $files, 'run' => true]); @@ -225,7 +224,7 @@ class ApplicationTest extends TestCase { } public function testCheckFileUserNotFound() { - $this->userSession->method("isLoggedIn")->willReturn(false); + $this->userSession->method('isLoggedIn')->willReturn(false); // Simulate zip download of folder folder $event = new GenericEvent(null, ['dir' => '/test', 'files' => ['test.txt'], 'run' => true]); |