diff options
Diffstat (limited to 'tests/lib/Share20/DefaultShareProviderTest.php')
-rw-r--r-- | tests/lib/Share20/DefaultShareProviderTest.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 0f0e77c3207..ff3cafbdf7c 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -73,7 +73,7 @@ class DefaultShareProviderTest extends \Test\TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject|IURLGenerator */ protected $urlGenerator; - public function setUp(): void { + protected function setUp(): void { $this->dbConn = \OC::$server->getDatabaseConnection(); $this->userManager = $this->createMock(IUserManager::class); $this->groupManager = $this->createMock(IGroupManager::class); @@ -100,7 +100,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ); } - public function tearDown(): void { + protected function tearDown(): void { $this->dbConn->getQueryBuilder()->delete('share')->execute(); $this->dbConn->getQueryBuilder()->delete('filecache')->execute(); $this->dbConn->getQueryBuilder()->delete('storages')->execute(); @@ -143,10 +143,10 @@ class DefaultShareProviderTest extends \Test\TestCase { - /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound - */ + public function testGetShareByIdNotExist() { + $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); + $this->provider->getShareById(1); } @@ -835,10 +835,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertSame(null, $share->getSharedWith()); } - /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound - */ + public function testGetShareByTokenNotFound() { + $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); + $this->provider->getShareByToken('invalidtoken'); } @@ -1538,11 +1538,11 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals('user2', $share2['share_with']); } - /** - * @expectedException \OC\Share20\Exception\ProviderException - * @expectedExceptionMessage Recipient not in receiving group - */ + public function testDeleteFromSelfGroupUserNotInGroup() { + $this->expectException(\OC\Share20\Exception\ProviderException::class); + $this->expectExceptionMessage('Recipient not in receiving group'); + $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ @@ -1583,11 +1583,11 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->provider->deleteFromSelf($share, 'user2'); } - /** - * @expectedException \OC\Share20\Exception\ProviderException - * @expectedExceptionMessage Group "group" does not exist - */ + public function testDeleteFromSelfGroupDoesNotExist() { + $this->expectException(\OC\Share20\Exception\ProviderException::class); + $this->expectExceptionMessage('Group "group" does not exist'); + $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ @@ -1674,11 +1674,11 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertCount(0, $shares); } - /** - * @expectedException \OC\Share20\Exception\ProviderException - * @expectedExceptionMessage Recipient does not match - */ + public function testDeleteFromSelfUserNotRecipient() { + $this->expectException(\OC\Share20\Exception\ProviderException::class); + $this->expectExceptionMessage('Recipient does not match'); + $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ @@ -1717,11 +1717,11 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->provider->deleteFromSelf($share, $user3); } - /** - * @expectedException \OC\Share20\Exception\ProviderException - * @expectedExceptionMessage Invalid shareType - */ + public function testDeleteFromSelfLink() { + $this->expectException(\OC\Share20\Exception\ProviderException::class); + $this->expectExceptionMessage('Invalid shareType'); + $qb = $this->dbConn->getQueryBuilder(); $stmt = $qb->insert('share') ->values([ |