diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-13 13:21:02 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-26 23:10:24 +0200 |
commit | 4a315ede819b700b6f55fa1c6dc70c60ea728ea4 (patch) | |
tree | 90eb9a39440c2215e306acba3dc081ea05cfad49 /apps/files_sharing | |
parent | 38ff7eaeced5e56786376f7c522fb07c8420c7b3 (diff) | |
download | nextcloud-server-4a315ede819b700b6f55fa1c6dc70c60ea728ea4.tar.gz nextcloud-server-4a315ede819b700b6f55fa1c6dc70c60ea728ea4.zip |
adjust ShareeAPIController invalid-input search unit test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index 2586876f88d..ccacd382935 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -284,7 +284,7 @@ class ShareesAPIControllerTest extends TestCase { $this->shareManager, $this->collaboratorSearch ]) - ->setMethods(array('isRemoteSharingAllowed', 'shareProviderExists')) + ->setMethods(['isRemoteSharingAllowed', 'shareProviderExists']) ->getMock(); $this->collaboratorSearch->expects($this->once()) @@ -344,35 +344,34 @@ class ShareesAPIControllerTest extends TestCase { $page = isset($getData['page']) ? $getData['page'] : 1; $perPage = isset($getData['perPage']) ? $getData['perPage'] : 200; - $config = $this->getMockBuilder('OCP\IConfig') - ->disableOriginalConstructor() - ->getMock(); + /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject $config */ + $config = $this->createMock(IConfig::class); $config->expects($this->never()) ->method('getAppValue'); + /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject $request */ + $request = $this->createMock(IRequest::class); + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject $urlGenerator */ + $urlGenerator = $this->createMock(IURLGenerator::class); + /** @var \PHPUnit_Framework_MockObject_MockObject|\OCA\Files_Sharing\Controller\ShareesAPIController $sharees */ $sharees = $this->getMockBuilder('\OCA\Files_Sharing\Controller\ShareesAPIController') ->setConstructorArgs([ 'files_sharing', - $this->getMockBuilder('OCP\IRequest')->disableOriginalConstructor()->getMock(), - $this->groupManager, - $this->userManager, - $this->contactsManager, + $request, $config, - $this->session, - $this->getMockBuilder('OCP\IURLGenerator')->disableOriginalConstructor()->getMock(), - $this->getMockBuilder('OCP\ILogger')->disableOriginalConstructor()->getMock(), + $urlGenerator, $this->shareManager, - $this->clientService, - $this->cloudIdManager + $this->collaboratorSearch ]) - ->setMethods(array('searchSharees', 'isRemoteSharingAllowed')) + ->setMethods(['isRemoteSharingAllowed']) ->getMock(); $sharees->expects($this->never()) - ->method('searchSharees'); - $sharees->expects($this->never()) ->method('isRemoteSharingAllowed'); + $this->collaboratorSearch->expects($this->never()) + ->method('search'); + try { $sharees->search('', null, $page, $perPage, null); $this->fail(); |