diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 17:27:18 +0300 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/sharebymail/tests | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/sharebymail/tests')
-rw-r--r-- | apps/sharebymail/tests/CapabilitiesTest.php | 2 | ||||
-rw-r--r-- | apps/sharebymail/tests/SettingsTest.php | 2 | ||||
-rw-r--r-- | apps/sharebymail/tests/ShareByMailProviderTest.php | 34 |
3 files changed, 19 insertions, 19 deletions
diff --git a/apps/sharebymail/tests/CapabilitiesTest.php b/apps/sharebymail/tests/CapabilitiesTest.php index 96fce010c1d..1e19ffd2eaf 100644 --- a/apps/sharebymail/tests/CapabilitiesTest.php +++ b/apps/sharebymail/tests/CapabilitiesTest.php @@ -26,7 +26,7 @@ class CapabilitiesTest extends TestCase { /** @var Capabilities */ private $capabilities; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->capabilities = new Capabilities(); diff --git a/apps/sharebymail/tests/SettingsTest.php b/apps/sharebymail/tests/SettingsTest.php index 12d8fc4d919..a05d4f5926b 100644 --- a/apps/sharebymail/tests/SettingsTest.php +++ b/apps/sharebymail/tests/SettingsTest.php @@ -34,7 +34,7 @@ class SettingsTest extends TestCase { /** @var SettingsManager | \PHPUnit_Framework_MockObject_MockObject */ private $settingsManager; - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $this->settingsManager = $this->getMockBuilder(SettingsManager::class) 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'; |