summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-10-04 12:58:11 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-10 22:13:47 +0200
commit2806a4bca78e2fc92ece696e94fe737a002b0a5e (patch)
treeb3128b39eaaf05f4c7097bd015a5f694a8a69ab7 /tests
parent1f0bc6936e36ab099999a49500cf935c28a06e2c (diff)
downloadnextcloud-server-2806a4bca78e2fc92ece696e94fe737a002b0a5e.tar.gz
nextcloud-server-2806a4bca78e2fc92ece696e94fe737a002b0a5e.zip
Cleanup test case
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index 2fe50460836..11a85fb54d0 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -20,7 +20,7 @@
*/
namespace Test\Share20;
-use OC\Share20\Exception\ProviderException;
+use OC\Authentication\Token\DefaultTokenMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\File;
use OCP\Files\Folder;
@@ -395,7 +395,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->createMock(IShare::class);
$share->method('getId')->willReturn($id);
- $provider = $this->getMockBuilder('OC\Share20\DefaultShareProvider')
+ /** @var DefaultShareProvider $provider */
+ $provider = $this->getMockBuilder(DefaultShareProvider::class)
->setConstructorArgs([
$this->dbConn,
$this->userManager,
@@ -484,7 +485,8 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share->method('getId')->willReturn($id);
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
- $provider = $this->getMockBuilder('OC\Share20\DefaultShareProvider')
+ /** @var DefaultTokenMapper $provider */
+ $provider = $this->getMockBuilder(DefaultShareProvider::class)
->setConstructorArgs([
$this->dbConn,
$this->userManager,
@@ -599,7 +601,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
$shareOwner = $this->createMock(IUser::class);
- $shareOwner->method('getUID')->WillReturn('shareOwner');
+ $shareOwner->method('getUID')->willReturn('shareOwner');
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(100);
@@ -1158,26 +1160,26 @@ class DefaultShareProviderTest extends \Test\TestCase {
]);
$this->assertEquals(1, $qb->execute());
- $file = $this->getMock('\OCP\Files\File');
+ $file = $this->createMock(File::class);
$this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf());
$this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]);
$groups = [];
foreach(range(0, 100) as $i) {
- $group = $this->getMock('\OCP\IGroup');
+ $group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('group'.$i);
$groups[] = $group;
}
- $group = $this->getMock('\OCP\IGroup');
+ $group = $this->createMock(IGroup::class);
$group->method('getGID')->willReturn('sharedWith');
$groups[] = $group;
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('sharedWith');
- $owner = $this->getMock('\OCP\IUser');
+ $owner = $this->createMock(IUser::class);
$owner->method('getUID')->willReturn('shareOwner');
- $initiator = $this->getMock('\OCP\IUser');
+ $initiator = $this->createMock(IUser::class);
$initiator->method('getUID')->willReturn('sharedBy');
$this->userManager->method('get')->willReturnMap([
@@ -1230,6 +1232,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0);
$this->assertCount(1, $share);
+ /** @var IShare $share */
$share = $share[0];
$this->assertEquals($id, $share->getId());
$this->assertEquals('sharedWith', $share->getSharedWith());
@@ -1279,6 +1282,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0);
$this->assertCount(1, $share);
+ /** @var IShare $share */
$share = $share[0];
$this->assertEquals($id, $share->getId());
$this->assertEquals('sharedWith', $share->getSharedWith());
@@ -1328,6 +1332,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0);
$this->assertCount(2, $shares);
+ /** @var IShare $share */
$share = $shares[0];
$this->assertEquals($id1, $share->getId());
$this->assertSame('sharedWith', $share->getSharedWith());