From 0123cd0ae345ae6c90955ea79331a48f7c5cf95d Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 23 Jul 2020 13:36:32 +0200 Subject: Use assertStringContainsString instead of assertContains on strings Signed-off-by: Morris Jobke --- tests/Core/Command/TwoFactorAuth/CleanupTest.php | 2 +- tests/Core/Command/TwoFactorAuth/DisableTest.php | 6 +++--- tests/Core/Command/TwoFactorAuth/EnableTest.php | 6 +++--- tests/Core/Command/TwoFactorAuth/EnforceTest.php | 12 ++++++------ tests/Core/Command/TwoFactorAuth/StateTest.php | 6 +++--- tests/lib/AppFramework/Http/DownloadResponseTest.php | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) (limited to 'tests') diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php index 98425aee223..75e869ad06f 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 fc0def50b90..5accaccb907 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 f3b66912f43..fc71cc32148 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 48c09f7e639..ed3deaa3fb3 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 ce52bcf2751..54ab85b51b8 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 1ad53f5db13..6c509b8bc59 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']); } } -- cgit v1.2.3