diff options
Diffstat (limited to 'tests/lib/Share20/ManagerTest.php')
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index f1a53200f5f..93f33fe30b9 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -481,7 +481,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date) @@ -594,30 +594,30 @@ class ManagerTest extends \Test\TestCase { ->willReturn($storage); $data = [ - [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], - [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], + [$this->createShare(null, IShare::TYPE_USER, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid user', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, null, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith is not a valid group', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true], [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unknown share type', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true], [$this->createShare(null, IShare::TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, $file, null, null, $user0, 31, null, null), 'SharedBy should be set', true], - [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Cannot share with yourself', true], + [$this->createShare(null, IShare::TYPE_USER, $file, $user0, $user0, $user0, 31, null, null), 'Cannot share with yourself', true], - [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_USER, null, $user2, $user0, $user0, 31, null, null), 'Path should be set', true], [$this->createShare(null, IShare::TYPE_GROUP, null, $group0, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], + [$this->createShare(null, IShare::TYPE_LINK, null, null, $user0, $user0, 31, null, null), 'Path should be set', true], - [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_USER, $node, $user2, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], [$this->createShare(null, IShare::TYPE_GROUP, $node, $group0, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], - [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], + [$this->createShare(null, IShare::TYPE_LINK, $node, null, $user0, $user0, 31, null, null), 'Path should be either a file or a folder', true], ]; $nonShareAble = $this->createMock(Folder::class); @@ -629,9 +629,9 @@ class ManagerTest extends \Test\TestCase { $nonShareAble->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonShareAble, $user2, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonShareAble, $group0, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $nonShareAble, null, $user0, $user0, 31, null, null), 'You are not allowed to share name', true]; $limitedPermssions = $this->createMock(File::class); $limitedPermssions->method('isShareable')->willReturn(true); @@ -644,17 +644,17 @@ class ManagerTest extends \Test\TestCase { $limitedPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, null, null, null), 'A share requires permissions', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, null, null, null), 'A share requires permissions', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, null, null, null), 'A share requires permissions', true]; $mount = $this->createMock(MoveableMount::class); $limitedPermssions->method('getMountPoint')->willReturn($mount); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cannot increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $limitedPermssions, $user2, $user0, $user0, 31, null, null), 'Cannot increase permissions of path', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $limitedPermssions, $group0, $user0, $user0, 17, null, null), 'Cannot increase permissions of path', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $limitedPermssions, null, $user0, $user0, 3, null, null), 'Cannot increase permissions of path', true]; $nonMoveableMountPermssions = $this->createMock(Folder::class); $nonMoveableMountPermssions->method('isShareable')->willReturn(true); @@ -667,7 +667,7 @@ class ManagerTest extends \Test\TestCase { $nonMoveableMountPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $nonMoveableMountPermssions, $user2, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $nonMoveableMountPermssions, $group0, $user0, $user0, 11, null, null), 'Cannot increase permissions of path', false]; $rootFolder = $this->createMock(Folder::class); @@ -675,9 +675,9 @@ class ManagerTest extends \Test\TestCase { $rootFolder->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_ALL); $rootFolder->method('getId')->willReturn(42); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You cannot share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $rootFolder, $user2, $user0, $user0, 30, null, null), 'You cannot share your root folder', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $rootFolder, $group0, $user0, $user0, 2, null, null), 'You cannot share your root folder', true]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You cannot share your root folder', true]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $rootFolder, null, $user0, $user0, 16, null, null), 'You cannot share your root folder', true]; $allPermssions = $this->createMock(Folder::class); $allPermssions->method('isShareable')->willReturn(true); @@ -688,12 +688,12 @@ class ManagerTest extends \Test\TestCase { $allPermssions->method('getStorage') ->willReturn($storage); - $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 30, null, null), 'Shares need at least read permissions', true]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 2, null, null), 'Shares need at least read permissions', true]; - $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_USER, $allPermssions, $user2, $user0, $user0, 31, null, null), null, false]; $data[] = [$this->createShare(null, IShare::TYPE_GROUP, $allPermssions, $group0, $user0, $user0, 3, null, null), null, false]; - $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; + $data[] = [$this->createShare(null, IShare::TYPE_LINK, $allPermssions, null, $user0, $user0, 17, null, null), null, false]; $remoteStorage = $this->createMock(Storage\IStorage::class); @@ -889,7 +889,7 @@ class ManagerTest extends \Test\TestCase { } $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P3D')); self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]); @@ -924,7 +924,7 @@ class ManagerTest extends \Test\TestCase { } $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P1D')); self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]); @@ -972,10 +972,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalEnforceValid($shareType) { $future = new \DateTime(); $future->add(new \DateInterval('P2D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1014,10 +1014,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalNoDefault($shareType) { $date = new \DateTime(); $date->add(new \DateInterval('P5D')); - $date->setTime(1,2,3); + $date->setTime(1, 2, 3); $expected = clone $date; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1062,7 +1062,7 @@ class ManagerTest extends \Test\TestCase { $expected = new \DateTime(); $expected->add(new \DateInterval('P3D')); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); if ($shareType === IShare::TYPE_USER) { $this->config->method('getAppValue') @@ -1097,10 +1097,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalDefault($shareType) { $future = new \DateTime(); $future->add(new \DateInterval('P5D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1139,7 +1139,7 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateInternalHookModification($shareType) { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $save = clone $nextWeek; @@ -1168,7 +1168,7 @@ class ManagerTest extends \Test\TestCase { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setShareType($shareType); @@ -1267,7 +1267,7 @@ class ManagerTest extends \Test\TestCase { ]); $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P3D')); self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]); @@ -1288,7 +1288,7 @@ class ManagerTest extends \Test\TestCase { ]); $expected = new \DateTime(); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $expected->add(new \DateInterval('P1D')); self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]); @@ -1320,10 +1320,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateEnforceValid() { $future = new \DateTime(); $future->add(new \DateInterval('P2D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($future); @@ -1349,10 +1349,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateNoDefault() { $date = new \DateTime(); $date->add(new \DateInterval('P5D')); - $date->setTime(1,2,3); + $date->setTime(1, 2, 3); $expected = clone $date; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -1388,7 +1388,7 @@ class ManagerTest extends \Test\TestCase { $expected = new \DateTime(); $expected->add(new \DateInterval('P3D')); - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $this->config->method('getAppValue') ->willReturnMap([ @@ -1411,10 +1411,10 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateDefault() { $future = new \DateTime(); $future->add(new \DateInterval('P5D')); - $future->setTime(1,2,3); + $future->setTime(1, 2, 3); $expected = clone $future; - $expected->setTime(0,0,0); + $expected->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($future); @@ -1440,7 +1440,7 @@ class ManagerTest extends \Test\TestCase { public function testValidateExpirationDateHookModification() { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $save = clone $nextWeek; @@ -1465,7 +1465,7 @@ class ManagerTest extends \Test\TestCase { $nextWeek = new \DateTime(); $nextWeek->add(new \DateInterval('P7D')); - $nextWeek->setTime(0,0,0); + $nextWeek->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($nextWeek); @@ -2623,7 +2623,7 @@ class ManagerTest extends \Test\TestCase { } $today = new \DateTime(); - $today->setTime(0,0,0); + $today->setTime(0, 0, 0); /* * Set the expiration date to today for some shares @@ -2851,7 +2851,7 @@ class ManagerTest extends \Test\TestCase { ->getMock(); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -2875,7 +2875,7 @@ class ManagerTest extends \Test\TestCase { ->willReturn('yes'); $date = new \DateTime(); - $date->setTime(0,0,0); + $date->setTime(0, 0, 0); $date->add(new \DateInterval('P2D')); $share = $this->manager->newShare(); $share->setExpirationDate($date); @@ -3195,7 +3195,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(15); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3276,7 +3276,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(15); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3342,7 +3342,7 @@ class ManagerTest extends \Test\TestCase { ->setPermissions(\OCP\Constants::PERMISSION_ALL); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3424,7 +3424,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3507,7 +3507,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3598,7 +3598,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3671,7 +3671,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3744,7 +3744,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3817,7 +3817,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(false); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3891,7 +3891,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(true); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); @@ -3965,7 +3965,7 @@ class ManagerTest extends \Test\TestCase { ->setSendPasswordByTalk(true); $tomorrow = new \DateTime(); - $tomorrow->setTime(0,0,0); + $tomorrow->setTime(0, 0, 0); $tomorrow->add(new \DateInterval('P1D')); $file = $this->createMock(File::class); |