diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/dav/tests/unit/Command | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) | |
download | nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.tar.gz nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.zip |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav/tests/unit/Command')
-rw-r--r-- | apps/dav/tests/unit/Command/ListCalendarsTest.php | 6 | ||||
-rw-r--r-- | apps/dav/tests/unit/Command/MoveCalendarTest.php | 19 | ||||
-rw-r--r-- | apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index 9cd02805133..0b381857573 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -58,11 +58,11 @@ class ListCalendarsTest extends TestCase { ); } - /** - * @expectedException InvalidArgumentException - */ + public function testWithBadUser() { + $this->expectException(\InvalidArgumentException::class); + $this->userManager->expects($this->once()) ->method('userExists') ->with(self::USERNAME) diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index 50c1a57e0a8..c097427b239 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -89,12 +89,13 @@ class MoveCalendarTest extends TestCase { /** * @dataProvider dataExecute * - * @expectedException InvalidArgumentException * @param $userOriginExists * @param $userDestinationExists */ public function testWithBadUserOrigin($userOriginExists, $userDestinationExists) { + $this->expectException(\InvalidArgumentException::class); + $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -115,12 +116,12 @@ class MoveCalendarTest extends TestCase { ]); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user. - */ + public function testMoveWithInexistantCalendar() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user.'); + $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') @@ -143,12 +144,12 @@ class MoveCalendarTest extends TestCase { ]); } - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage User <user2> already has a calendar named <personal>. - */ + public function testMoveWithExistingDestinationCalendar() { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('User <user2> already has a calendar named <personal>.'); + $this->userManager->expects($this->at(0)) ->method('userExists') ->with('user') diff --git a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php index 1e415ceafca..7847273c975 100644 --- a/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php +++ b/apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php @@ -37,7 +37,7 @@ use Test\TestCase; */ class RemoveInvalidSharesTest extends TestCase { - public function setUp(): void { + protected function setUp(): void { parent::setUp(); $db = \OC::$server->getDatabaseConnection(); |