diff options
Diffstat (limited to 'apps/sharebymail/tests/ShareByMailProviderTest.php')
-rw-r--r-- | apps/sharebymail/tests/ShareByMailProviderTest.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 678e6cc0da0..4efd528b2d1 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -97,7 +97,7 @@ class ShareByMailProviderTest extends TestCase { /** @var CapabilitiesManager | \PHPUnit_Framework_MockObject_MockObject */ private $capabilitiesManager; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->shareManager = \OC::$server->getShareManager(); @@ -174,7 +174,7 @@ class ShareByMailProviderTest extends TestCase { } - public function tearDown(): void { + protected function tearDown(): void { $this->connection->getQueryBuilder()->delete('share')->execute(); parent::tearDown(); @@ -305,10 +305,10 @@ class ShareByMailProviderTest extends TestCase { ); } - /** - * @expectedException \Exception - */ + public function testCreateFailed() { + $this->expectException(\Exception::class); + $this->share->expects($this->once())->method('getSharedWith')->willReturn('user1'); $node = $this->getMockBuilder('OCP\Files\Node')->getMock(); $node->expects($this->any())->method('getName')->willReturn('fileName'); @@ -348,10 +348,10 @@ class ShareByMailProviderTest extends TestCase { } - /** - * @expectedException \OC\HintException - */ + public function testCreateMailShareFailed() { + $this->expectException(\OC\HintException::class); + $this->share->expects($this->any())->method('getToken')->willReturn('token'); $this->share->expects($this->once())->method('setToken')->with('token'); $node = $this->getMockBuilder('OCP\Files\Node')->getMock(); @@ -572,10 +572,10 @@ class ShareByMailProviderTest extends TestCase { $this->assertInstanceOf('OCP\Share\IShare', $result); } - /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound - */ + public function testGetShareByIdFailed() { + $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); + $instance = $this->getInstance(['createShareObject']); $itemSource = 11; @@ -657,10 +657,10 @@ class ShareByMailProviderTest extends TestCase { $this->assertInstanceOf('OCP\Share\IShare', $result); } - /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound - */ + public function testGetShareByTokenFailed() { + $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); + $itemSource = 11; $itemType = 'file'; @@ -774,10 +774,10 @@ class ShareByMailProviderTest extends TestCase { $this->assertSame($token, $result['token']); } - /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound - */ + public function testGetRawShareFailed() { + $this->expectException(\OCP\Share\Exceptions\ShareNotFound::class); + $itemSource = 11; $itemType = 'file'; $shareWith = 'user@server.com'; |