diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-07-23 21:38:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 21:38:22 +0200 |
commit | a169bd243ff4b014fa4238845dbebbbc2a4d1021 (patch) | |
tree | a1fee830c286b0911aae9f4c141572a92261080d /apps | |
parent | 173f8abc7ed48d2436d8df10ad66bc4907d4bb52 (diff) | |
parent | 761cdf9877be6d286f96e1f3eb4beab052b89baa (diff) | |
download | nextcloud-server-a169bd243ff4b014fa4238845dbebbbc2a4d1021.tar.gz nextcloud-server-a169bd243ff4b014fa4238845dbebbbc2a4d1021.zip |
Merge pull request #21972 from nextcloud/techdebt/noid/cleanup-phpunit-warnings
Fix PHPUnit deprecation warnings
Diffstat (limited to 'apps')
4 files changed, 13 insertions, 12 deletions
diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 76335f00bfe..bd6a8856d51 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -279,7 +279,7 @@ EOD; $this->assertCount(0, $calendarObjects); } - + public function testMultipleCalendarObjectsWithSameUID() { $this->expectException(\Sabre\DAV\Exception\BadRequest::class); $this->expectExceptionMessage('Calendar object with uid already exists in this calendar collection.'); @@ -441,7 +441,7 @@ EOD; $expectedEventsInResult = array_map(function ($index) use ($events) { return $events[$index]; }, $expectedEventsInResult); - $this->assertEquals($expectedEventsInResult, $result, '', 0.0, 10, true); + $this->assertEqualsCanonicalizing($expectedEventsInResult, $result); } public function testGetCalendarObjectByUID() { diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index b63a973668e..c7dae373c94 100644 --- a/apps/dav/tests/unit/Command/ListCalendarsTest.php +++ b/apps/dav/tests/unit/Command/ListCalendarsTest.php @@ -63,7 +63,6 @@ class ListCalendarsTest extends TestCase { ); } - public function testWithBadUser() { $this->expectException(\InvalidArgumentException::class); @@ -76,7 +75,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertContains("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay()); + $this->assertStringContainsString("User <" . self::USERNAME . "> in unknown", $commandTester->getDisplay()); } public function testWithCorrectUserWithNoCalendars() { @@ -94,7 +93,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertContains("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); + $this->assertStringContainsString("User <" . self::USERNAME . "> has no calendars\n", $commandTester->getDisplay()); } public function dataExecute() { @@ -133,7 +132,7 @@ class ListCalendarsTest extends TestCase { $commandTester->execute([ 'uid' => self::USERNAME, ]); - $this->assertContains($output, $commandTester->getDisplay()); - $this->assertNotContains(BirthdayService::BIRTHDAY_CALENDAR_URI, $commandTester->getDisplay()); + $this->assertStringContainsString($output, $commandTester->getDisplay()); + $this->assertStringNotContainsString(BirthdayService::BIRTHDAY_CALENDAR_URI, $commandTester->getDisplay()); } } diff --git a/apps/dav/tests/unit/Command/MoveCalendarTest.php b/apps/dav/tests/unit/Command/MoveCalendarTest.php index a0567401727..750863175a2 100644 --- a/apps/dav/tests/unit/Command/MoveCalendarTest.php +++ b/apps/dav/tests/unit/Command/MoveCalendarTest.php @@ -121,7 +121,7 @@ class MoveCalendarTest extends TestCase { ]); } - + 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.'); @@ -148,7 +148,7 @@ class MoveCalendarTest extends TestCase { ]); } - + public function testMoveWithExistingDestinationCalendar() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('User <user2> already has a calendar named <personal>.'); @@ -313,7 +313,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); } public function testMoveWithDestinationNotPartOfGroupAndForce() { @@ -360,7 +360,7 @@ class MoveCalendarTest extends TestCase { '--force' => true ]); - $this->assertContains("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); + $this->assertStringContainsString("[OK] Calendar <personal> was moved from user <user> to <user2>", $commandTester->getDisplay()); } public function dataTestMoveWithCalendarAlreadySharedToDestination(): array { diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 2b04428848a..e3e13f05867 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -198,7 +198,9 @@ class FederatedShareProviderTest extends \Test\TestCase { 'accepted' => 0, 'token' => 'token', ]; - $this->assertArraySubset($expected, $data); + foreach (array_keys($expected) as $key) { + $this->assertEquals($expected[$key], $data[$key], "Assert that value for key '$key' is the same"); + } $this->assertEquals($data['id'], $share->getId()); $this->assertEquals(IShare::TYPE_REMOTE, $share->getShareType()); |