diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index 60b1efdfa2..7ff480fec3 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -46,8 +46,8 @@ class DeprecationTest extends TestCase public function testItCanBeConvertedToAString() { $deprecation = new Deprecation('💩', $this->debugBacktrace(), __FILE__); - $this->assertContains('💩', $deprecation->toString()); - $this->assertContains(__FUNCTION__, $deprecation->toString()); + $this->assertStringContainsString('💩', $deprecation->toString()); + $this->assertStringContainsString(__FUNCTION__, $deprecation->toString()); } public function testItRulesOutFilesOutsideVendorsAsIndirect() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php index 0883ba614e..aa70e4ed80 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CachePoolDeleteCommandTest.php @@ -45,7 +45,7 @@ class CachePoolDeleteCommandTest extends TestCase $tester = $this->getCommandTester($this->getKernel()); $tester->execute(['pool' => 'foo', 'key' => 'bar']); - $this->assertContains('[OK] Cache item "bar" was successfully deleted.', $tester->getDisplay()); + $this->assertStringContainsString('[OK] Cache item "bar" was successfully deleted.', $tester->getDisplay()); } public function testCommandWithInValidKey() @@ -62,7 +62,7 @@ class CachePoolDeleteCommandTest extends TestCase $tester = $this->getCommandTester($this->getKernel()); $tester->execute(['pool' => 'foo', 'key' => 'bar']); - $this->assertContains('[NOTE] Cache item "bar" does not exist in cache pool "foo".', $tester->getDisplay()); + $this->assertStringContainsString('[NOTE] Cache item "bar" does not exist in cache pool "foo".', $tester->getDisplay()); } public function testCommandDeleteFailed() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php index 542272da55..4f40f3e6bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php @@ -69,7 +69,7 @@ EOF; ); $this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success'); - $this->assertContains('[OK] All 0 XLIFF files contain valid syntax', trim($tester->getDisplay())); + $this->assertStringContainsString('[OK] All 0 XLIFF files contain valid syntax', trim($tester->getDisplay())); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index f8fe513d51..90ecc1ab3e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -226,7 +226,7 @@ class ApplicationTest extends TestCase $this->assertSame(0, $tester->getStatusCode()); $display = explode('Lists commands', $tester->getDisplay()); - $this->assertContains(trim('[WARNING] Some commands could not be registered:'), trim($display[1])); + $this->assertStringContainsString(trim('[WARNING] Some commands could not be registered:'), trim($display[1])); } public function testSuggestingPackagesWithExactMatch() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php index a76234697e..d7e5aae80c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolListCommandTest.php @@ -31,8 +31,8 @@ class CachePoolListCommandTest extends AbstractWebTestCase $tester->execute([]); $this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success'); - $this->assertContains('cache.app', $tester->getDisplay()); - $this->assertContains('cache.system', $tester->getDisplay()); + $this->assertStringContainsString('cache.app', $tester->getDisplay()); + $this->assertStringContainsString('cache.system', $tester->getDisplay()); } public function testEmptyList() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php index d47aa9ba2e..5832a98c7e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php @@ -71,7 +71,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase $tester = $this->createCommandTester(); $tester->execute(['name' => 'FrameworkBundle']); - $this->assertContains("cookie_httponly: '%env(bool:COOKIE_HTTPONLY)%'", $tester->getDisplay()); + $this->assertStringContainsString("cookie_httponly: '%env(bool:COOKIE_HTTPONLY)%'", $tester->getDisplay()); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index b3327ed0ac..aeb7f44410 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -61,8 +61,8 @@ class ContainerDebugCommandTest extends AbstractWebTestCase $this->assertNotContains('private_alias', $tester->getDisplay()); $tester->run(['command' => 'debug:container']); - $this->assertContains('public', $tester->getDisplay()); - $this->assertContains('private_alias', $tester->getDisplay()); + $this->assertStringContainsString('public', $tester->getDisplay()); + $this->assertStringContainsString('private_alias', $tester->getDisplay()); } /** @@ -130,7 +130,7 @@ TXT $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:container', '--env-var' => 'js'], ['decorated' => false]); - $this->assertContains(file_get_contents(__DIR__.'/Fixtures/describe_env_vars.txt'), $tester->getDisplay(true)); + $this->assertStringContainsString(file_get_contents(__DIR__.'/Fixtures/describe_env_vars.txt'), $tester->getDisplay(true)); } public function provideIgnoreBackslashWhenFindingService() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index b4ffba44e3..0ba6feaf22 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -56,7 +56,7 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring', 'search' => 'HttpKernelHttpKernelInterface']); - $this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); + $this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); } public function testSearchNoResults() @@ -83,7 +83,7 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring', 'search' => 'redirect']); - $this->assertContains(' more concrete service would be displayed when adding the "--all" option.', $tester->getDisplay()); + $this->assertStringContainsString(' more concrete service would be displayed when adding the "--all" option.', $tester->getDisplay()); } public function testSearchNotAliasedServiceWithAll() @@ -95,6 +95,6 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring', 'search' => 'redirect', '--all' => true]); - $this->assertContains('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay()); + $this->assertStringContainsString('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay()); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php index 629e41b7ce..22114349d5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/RouterDebugCommandTest.php @@ -34,9 +34,9 @@ class RouterDebugCommandTest extends AbstractWebTestCase $display = $tester->getDisplay(); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('routerdebug_test', $display); - $this->assertContains('/test', $display); - $this->assertContains('/session', $display); + $this->assertStringContainsString('routerdebug_test', $display); + $this->assertStringContainsString('/test', $display); + $this->assertStringContainsString('/session', $display); } public function testDumpOneRoute() @@ -45,8 +45,8 @@ class RouterDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'routerdebug_session_welcome']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('routerdebug_session_welcome', $tester->getDisplay()); - $this->assertContains('/session', $tester->getDisplay()); + $this->assertStringContainsString('routerdebug_session_welcome', $tester->getDisplay()); + $this->assertStringContainsString('/session', $tester->getDisplay()); } public function testSearchMultipleRoutes() @@ -56,9 +56,9 @@ class RouterDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'routerdebug'], ['interactive' => true]); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Select one of the matching routes:', $tester->getDisplay()); - $this->assertContains('routerdebug_test', $tester->getDisplay()); - $this->assertContains('/test', $tester->getDisplay()); + $this->assertStringContainsString('Select one of the matching routes:', $tester->getDisplay()); + $this->assertStringContainsString('routerdebug_test', $tester->getDisplay()); + $this->assertStringContainsString('/test', $tester->getDisplay()); } public function testSearchWithThrow() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php index 8ce0ce0609..382c4b5d94 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/TranslationDebugCommandTest.php @@ -33,13 +33,13 @@ class TranslationDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['locale' => 'en']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('missing messages hello_from_construct_arg_service', $tester->getDisplay()); - $this->assertContains('missing messages hello_from_subscriber_service', $tester->getDisplay()); - $this->assertContains('missing messages hello_from_property_service', $tester->getDisplay()); - $this->assertContains('missing messages hello_from_method_calls_service', $tester->getDisplay()); - $this->assertContains('missing messages hello_from_controller', $tester->getDisplay()); - $this->assertContains('unused validators This value should be blank.', $tester->getDisplay()); - $this->assertContains('unused security Invalid CSRF token.', $tester->getDisplay()); + $this->assertStringContainsString('missing messages hello_from_construct_arg_service', $tester->getDisplay()); + $this->assertStringContainsString('missing messages hello_from_subscriber_service', $tester->getDisplay()); + $this->assertStringContainsString('missing messages hello_from_property_service', $tester->getDisplay()); + $this->assertStringContainsString('missing messages hello_from_method_calls_service', $tester->getDisplay()); + $this->assertStringContainsString('missing messages hello_from_controller', $tester->getDisplay()); + $this->assertStringContainsString('unused validators This value should be blank.', $tester->getDisplay()); + $this->assertStringContainsString('unused security Invalid CSRF token.', $tester->getDisplay()); } private function createCommandTester(): CommandTester diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php index 03da552254..55064d863a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -109,7 +109,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase ], ['interactive' => false]); $output = $this->passwordEncoderCommandTester->getDisplay(); - $this->assertContains('Password encoding succeeded', $output); + $this->assertStringContainsString('Password encoding succeeded', $output); $encoder = new NativePasswordEncoder(); preg_match('# Encoded password\s{1,}([\w+\/$.,=]+={0,2})\s+#', $output, $matches); @@ -130,7 +130,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase ], ['interactive' => false]); $output = $this->passwordEncoderCommandTester->getDisplay(); - $this->assertContains('Password encoding succeeded', $output); + $this->assertStringContainsString('Password encoding succeeded', $output); preg_match('# Encoded password\s+(\$?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches); $hash = $matches[1]; diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php index cd3b2c60b6..ae9f143cad 100644 --- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php @@ -159,9 +159,9 @@ class HttpBrowserTest extends AbstractBrowserTest ->expects($this->once()) ->method('request') ->with('POST', 'http://example.com/', $this->callback(function ($options) { - $this->assertContains('Content-Type: multipart/form-data', implode('', $options['headers'])); + $this->assertStringContainsString('Content-Type: multipart/form-data', implode('', $options['headers'])); $this->assertInstanceOf('\Generator', $options['body']); - $this->assertContains('my_file', implode('', iterator_to_array($options['body']))); + $this->assertStringContainsString('my_file', implode('', iterator_to_array($options['body']))); return true; })) diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile b/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index c32578d8a6..6f3d7bba44 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -506,9 +506,9 @@ class ApplicationTest extends TestCase $tester->setInputs(['y']); $tester->run(['command' => 'foos'], ['decorated' => false]); $display = trim($tester->getDisplay(true)); - $this->assertContains('Command "foos" is not defined', $display); - $this->assertContains('Do you want to run "foo" instead? (yes/no) [no]:', $display); - $this->assertContains('called', $display); + $this->assertStringContainsString('Command "foos" is not defined', $display); + $this->assertStringContainsString('Do you want to run "foo" instead? (yes/no) [no]:', $display); + $this->assertStringContainsString('called', $display); } public function testDontRunAlternativeCommandName() @@ -521,8 +521,8 @@ class ApplicationTest extends TestCase $exitCode = $tester->run(['command' => 'foos'], ['decorated' => false]); $this->assertSame(1, $exitCode); $display = trim($tester->getDisplay(true)); - $this->assertContains('Command "foos" is not defined', $display); - $this->assertContains('Do you want to run "foo" instead? (yes/no) [no]:', $display); + $this->assertStringContainsString('Command "foos" is not defined', $display); + $this->assertStringContainsString('Do you want to run "foo" instead? (yes/no) [no]:', $display); } public function provideInvalidCommandNamesSingle() @@ -854,7 +854,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo'], ['decorated' => false]); - $this->assertContains('[InvalidArgumentException@anonymous]', $tester->getDisplay(true)); + $this->assertStringContainsString('[InvalidArgumentException@anonymous]', $tester->getDisplay(true)); $application = new Application(); $application->setAutoExit(false); @@ -865,7 +865,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo'], ['decorated' => false]); - $this->assertContains('Dummy type "@anonymous" is invalid.', $tester->getDisplay(true)); + $this->assertStringContainsString('Dummy type "@anonymous" is invalid.', $tester->getDisplay(true)); } public function testRenderExceptionStackTraceContainsRootException() @@ -879,7 +879,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo'], ['decorated' => false]); - $this->assertContains('[InvalidArgumentException@anonymous]', $tester->getDisplay(true)); + $this->assertStringContainsString('[InvalidArgumentException@anonymous]', $tester->getDisplay(true)); $application = new Application(); $application->setAutoExit(false); diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index dae390b8cb..8d29154d85 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -58,7 +58,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg" $handler->sendPhpResponse(new \RuntimeException($htmlWithXss)); $response = ob_get_clean(); - $this->assertContains(sprintf('