diff --git a/apps/dav/tests/unit/Command/ListCalendarsTest.php b/apps/dav/tests/unit/Command/ListCalendarsTest.php index b63a973668..c7dae373c9 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 a056740172..750863175a 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 has no calendar named . 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 already has a calendar named .'); @@ -313,7 +313,7 @@ class MoveCalendarTest extends TestCase { 'destinationuid' => 'user2', ]); - $this->assertContains("[OK] Calendar was moved from user to ", $commandTester->getDisplay()); + $this->assertStringContainsString("[OK] Calendar was moved from user to ", $commandTester->getDisplay()); } public function testMoveWithDestinationNotPartOfGroupAndForce() { @@ -360,7 +360,7 @@ class MoveCalendarTest extends TestCase { '--force' => true ]); - $this->assertContains("[OK] Calendar was moved from user to ", $commandTester->getDisplay()); + $this->assertStringContainsString("[OK] Calendar was moved from user to ", $commandTester->getDisplay()); } public function dataTestMoveWithCalendarAlreadySharedToDestination(): array { diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 98425aee22..75e869ad06 100644 --- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php +++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php @@ -60,6 +60,6 @@ class CleanupTest extends TestCase { $this->assertEquals(0, $rc); $output = $this->cmd->getDisplay(); - $this->assertContains("All user-provider associations for provider u2f have been removed", $output); + $this->assertStringContainsString("All user-provider associations for provider u2f have been removed", $output); } } diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php index fc0def50b9..5accaccb90 100644 --- a/tests/Core/Command/TwoFactorAuth/DisableTest.php +++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php @@ -67,7 +67,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertContains("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -87,7 +87,7 @@ class DisableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertContains("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); } public function testEnabled() { @@ -107,6 +107,6 @@ class DisableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertContains("Two-factor provider totp disabled for user ricky", $this->command->getDisplay()); + $this->assertStringContainsString("Two-factor provider totp disabled for user ricky", $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php index f3b66912f4..fc71cc3214 100644 --- a/tests/Core/Command/TwoFactorAuth/EnableTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php @@ -67,7 +67,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(1, $rc); - $this->assertContains("Invalid UID", $this->command->getDisplay()); + $this->assertStringContainsString("Invalid UID", $this->command->getDisplay()); } public function testEnableNotSupported() { @@ -87,7 +87,7 @@ class EnableTest extends TestCase { ]); $this->assertEquals(2, $rc); - $this->assertContains("The provider does not support this operation", $this->command->getDisplay()); + $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay()); } public function testEnabled() { @@ -107,6 +107,6 @@ class EnableTest extends TestCase { ]); $this->assertEquals(0, $rc); - $this->assertContains("Two-factor provider totp enabled for user belle", $this->command->getDisplay()); + $this->assertStringContainsString("Two-factor provider totp enabled for user belle", $this->command->getDisplay()); } } diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php index 48c09f7e63..ed3deaa3fb 100644 --- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php +++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php @@ -64,7 +64,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); } public function testEnforceForOneGroup() { @@ -82,7 +82,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is enforced for members of the group(s) twofactorers", $display); + $this->assertStringContainsString("Two-factor authentication is enforced for members of the group(s) twofactorers", $display); } public function testEnforceForAllExceptOneGroup() { @@ -100,7 +100,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is enforced for all users, except members of yoloers", $display); + $this->assertStringContainsString("Two-factor authentication is enforced for all users, except members of yoloers", $display); } public function testDisableEnforced() { @@ -117,7 +117,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString("Two-factor authentication is not enforced", $display); } public function testCurrentStateEnabled() { @@ -129,7 +129,7 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is enforced for all users", $display); + $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display); } public function testCurrentStateDisabled() { @@ -141,6 +141,6 @@ class EnforceTest extends TestCase { $this->assertEquals(0, $rc); $display = $this->command->getDisplay(); - $this->assertContains("Two-factor authentication is not enforced", $display); + $this->assertStringContainsString("Two-factor authentication is not enforced", $display); } } diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php index ce52bcf275..54ab85b51b 100644 --- a/tests/Core/Command/TwoFactorAuth/StateTest.php +++ b/tests/Core/Command/TwoFactorAuth/StateTest.php @@ -61,7 +61,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertContains("Invalid UID", $output); + $this->assertStringContainsString("Invalid UID", $output); } public function testStateNoProvidersActive() { @@ -84,7 +84,7 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertContains("Two-factor authentication is not enabled for user eldora", $output); + $this->assertStringContainsString("Two-factor authentication is not enabled for user eldora", $output); } public function testStateOneProviderActive() { @@ -107,6 +107,6 @@ class StateTest extends TestCase { ]); $output = $this->cmd->getDisplay(); - $this->assertContains("Two-factor authentication is enabled for user mohamed", $output); + $this->assertStringContainsString("Two-factor authentication is enabled for user mohamed", $output); } } diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index 1ad53f5db1..6c509b8bc5 100644 --- a/tests/lib/AppFramework/Http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -45,7 +45,7 @@ class DownloadResponseTest extends \Test\TestCase { public function testHeaders() { $headers = $this->response->getHeaders(); - $this->assertContains('attachment; filename="file"', $headers['Content-Disposition']); - $this->assertContains('content', $headers['Content-Type']); + $this->assertStringContainsString('attachment; filename="file"', $headers['Content-Disposition']); + $this->assertStringContainsString('content', $headers['Content-Type']); } }