]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use assertStringContainsString instead of assertContains on strings
authorMorris Jobke <hey@morrisjobke.de>
Thu, 23 Jul 2020 11:36:32 +0000 (13:36 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 30 Jul 2020 11:17:13 +0000 (13:17 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
apps/dav/tests/unit/Command/ListCalendarsTest.php
apps/dav/tests/unit/Command/MoveCalendarTest.php
tests/Core/Command/TwoFactorAuth/CleanupTest.php
tests/Core/Command/TwoFactorAuth/DisableTest.php
tests/Core/Command/TwoFactorAuth/EnableTest.php
tests/Core/Command/TwoFactorAuth/EnforceTest.php
tests/Core/Command/TwoFactorAuth/StateTest.php
tests/lib/AppFramework/Http/DownloadResponseTest.php

index 42e24be5cd3506a7ebd58306311459056f0b74e6..9a6723860b959b2171ebefe206f0fb920894fb9f 100644 (file)
@@ -63,7 +63,6 @@ class ListCalendarsTest extends TestCase {
                );
        }
 
-       
        public function testWithBadUser()
        {
                $this->expectException(\InvalidArgumentException::class);
@@ -77,7 +76,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()
@@ -96,7 +95,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()
@@ -137,7 +136,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());
        }
 }
index e286c4f292a17d1010573cfad069da209a3d6b9a..c537fcb63e748833983fa23cdf562be1a62d1e22 100644 (file)
@@ -121,7 +121,6 @@ class MoveCalendarTest extends TestCase {
                ]);
        }
 
-       
        public function testMoveWithInexistantCalendar()
        {
                $this->expectException(\InvalidArgumentException::class);
@@ -149,7 +148,7 @@ class MoveCalendarTest extends TestCase {
                ]);
        }
 
-       
+
        public function testMoveWithExistingDestinationCalendar()
        {
                $this->expectException(\InvalidArgumentException::class);
@@ -319,7 +318,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()
@@ -367,7 +366,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
index 24aaa9abce22fdb995d4394fed19153ca7b39458..6281c2e4c5f64895928f839eca69ac96384b6619 100644 (file)
@@ -60,7 +60,7 @@ 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);
        }
 
 }
index fc0def50b90f4c9e3f539d51cf105212b2dd5a0b..5accaccb907e8d0081106581f954f54bc7ea0ee4 100644 (file)
@@ -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());
        }
 }
index faf00ed1deda245729b13262fe7fa8d7921298f9..af7140e6e75749a3d88ad5cbfcaefb24f0011a59 100644 (file)
@@ -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,7 +107,7 @@ 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());
        }
 
 }
index aa2cbc10620470e16fb00f5d9b9b80d0aace76d0..744ea9e3b5d5d70cd19f4d15ee6c7d6badbe08d8 100644 (file)
@@ -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,7 +141,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);
        }
 
 }
index 8d1b28862d30edeb53427fa70880dd91d61eb8f4..2de374dc6d019e40916bdcfa3c8ad965d936f741 100644 (file)
@@ -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,7 +107,7 @@ 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);
        }
 
 }
index 5f816eaeb761a265aee006a8d157e5fb7bbde0fd..f1beacf5253a1c2fccbc594d22b58cf6263eccef 100644 (file)
@@ -47,8 +47,8 @@ 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']);
        }