diff --git a/phpunit b/phpunit index f2718fadcf..437f7b9b44 100755 --- a/phpunit +++ b/phpunit @@ -1,7 +1,7 @@ #!/usr/bin/env php getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output); $dispatcher->dispatch($event, ConsoleEvents::COMMAND); - $this->assertContains('Before command message.', $out = $output->fetch()); - $this->assertContains('After command message.', $out); + $this->assertStringContainsString('Before command message.', $out = $output->fetch()); + $this->assertStringContainsString('After command message.', $out); $event = new ConsoleTerminateEvent(new Command('foo'), $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(), $output, 0); $dispatcher->dispatch($event, ConsoleEvents::TERMINATE); - $this->assertContains('Before terminate message.', $out = $output->fetch()); - $this->assertContains('After terminate message.', $out); + $this->assertStringContainsString('Before terminate message.', $out = $output->fetch()); + $this->assertStringContainsString('After terminate message.', $out); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php index b7ba8b0d3d..7aae33bbad 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/CoverageListenerTest.php @@ -29,14 +29,14 @@ class CoverageListenerTest extends TestCase exec("$php $phpunit -c $dir/phpunit-without-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); $output = implode("\n", $output); - $this->assertContains('FooCov', $output); + $this->assertStringContainsString('FooCov', $output); exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text 2> /dev/null", $output); $output = implode("\n", $output); - $this->assertNotContains('FooCov', $output); - $this->assertContains("SutNotFoundTest::test\nCould not find the tested class.", $output); - $this->assertNotContains("CoversTest::test\nCould not find the tested class.", $output); - $this->assertNotContains("CoversDefaultClassTest::test\nCould not find the tested class.", $output); - $this->assertNotContains("CoversNothingTest::test\nCould not find the tested class.", $output); + $this->assertStringNotContainsString('FooCov', $output); + $this->assertStringContainsString("SutNotFoundTest::test\nCould not find the tested class.", $output); + $this->assertStringNotContainsString("CoversTest::test\nCould not find the tested class.", $output); + $this->assertStringNotContainsString("CoversDefaultClassTest::test\nCould not find the tested class.", $output); + $this->assertStringNotContainsString("CoversNothingTest::test\nCould not find the tested class.", $output); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php index 964b29acd9..0a500e1279 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php @@ -27,7 +27,7 @@ class DebugCommandTest extends TestCase $ret = $tester->execute([], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Functions', trim($tester->getDisplay())); + $this->assertStringContainsString('Functions', trim($tester->getDisplay())); } public function testFilterAndJsonFormatOptions() @@ -284,7 +284,7 @@ TXT $ret = $tester->execute(['name' => 'base.html.twig'], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('[OK]', $tester->getDisplay()); + $this->assertStringContainsString('[OK]', $tester->getDisplay()); } public function testWithGlobals() @@ -293,7 +293,7 @@ TXT $tester = $this->createCommandTester([], [], null, null, false, ['message' => $message]); $tester->execute([], ['decorated' => true]); $display = $tester->getDisplay(); - $this->assertContains(json_encode($message), $display); + $this->assertStringContainsString(json_encode($message), $display); } public function testWithGlobalsJson() diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index e1fb436127..df99cd7518 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -31,7 +31,7 @@ class LintCommandTest extends TestCase $ret = $tester->execute(['filename' => [$filename]], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('OK in', trim($tester->getDisplay())); + $this->assertStringContainsString('OK in', trim($tester->getDisplay())); } public function testLintIncorrectFile() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php index 497511f629..a4182d2618 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php @@ -29,7 +29,7 @@ class RouterMatchCommandTest extends TestCase $ret = $tester->execute(['path_info' => '/foo', 'foo'], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Route Name | foo', $tester->getDisplay()); + $this->assertStringContainsString('Route Name | foo', $tester->getDisplay()); } public function testWithNotMatchPath() @@ -38,7 +38,7 @@ class RouterMatchCommandTest extends TestCase $ret = $tester->execute(['path_info' => '/test', 'foo'], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of failure'); - $this->assertContains('None of the routes match the path "/test"', $tester->getDisplay()); + $this->assertStringContainsString('None of the routes match the path "/test"', $tester->getDisplay()); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php index cb6595bf1f..410ab4f90c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php @@ -41,7 +41,7 @@ class YamlLintCommandTest extends TestCase ); $this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success'); - $this->assertContains('OK', trim($tester->getDisplay())); + $this->assertStringContainsString('OK', trim($tester->getDisplay())); } public function testLintIncorrectFile() @@ -55,7 +55,7 @@ bar'; $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error'); - $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); + $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); } public function testLintFileNotReadable() @@ -106,7 +106,7 @@ EOF; ); $this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success'); - $this->assertContains('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay())); + $this->assertStringContainsString('[OK] All 0 YAML 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 c9f93b96ea..f8fe513d51 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -167,9 +167,9 @@ class ApplicationTest extends TestCase $output = $tester->getDisplay(); $this->assertSame(0, $tester->getStatusCode()); - $this->assertContains('Some commands could not be registered:', $output); - $this->assertContains('throwing', $output); - $this->assertContains('fine', $output); + $this->assertStringContainsString('Some commands could not be registered:', $output); + $this->assertStringContainsString('throwing', $output); + $this->assertStringContainsString('fine', $output); } public function testRegistrationErrorsAreDisplayedOnCommandNotFound() @@ -195,8 +195,8 @@ class ApplicationTest extends TestCase $output = $tester->getDisplay(); $this->assertSame(1, $tester->getStatusCode()); - $this->assertContains('Some commands could not be registered:', $output); - $this->assertContains('Command "fine" is not defined.', $output); + $this->assertStringContainsString('Some commands could not be registered:', $output); + $this->assertStringContainsString('Command "fine" is not defined.', $output); } public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php index 1805fa074b..bdee7c8ecf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerNameParserTest.php @@ -129,9 +129,9 @@ class ControllerNameParserTest extends TestCase if (false === $suggestedBundleName) { // make sure we don't have a suggestion - $this->assertNotContains('Did you mean', $e->getMessage()); + $this->assertStringNotContainsString('Did you mean', $e->getMessage()); } else { - $this->assertContains(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage()); + $this->assertStringContainsString(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage()); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php index c3a49dd61b..462a415fff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTraitTest.php @@ -187,8 +187,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); - $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); + $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition')); } public function testFileAsInline() @@ -203,8 +203,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition')); - $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition')); + $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition')); } public function testFileWithOwnFileName() @@ -220,8 +220,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); - $this->assertContains($fileName, $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); + $this->assertStringContainsString($fileName, $response->headers->get('content-disposition')); } public function testFileWithOwnFileNameAsInline() @@ -237,8 +237,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition')); - $this->assertContains($fileName, $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition')); + $this->assertStringContainsString($fileName, $response->headers->get('content-disposition')); } public function testFileFromPath() @@ -253,8 +253,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); - $this->assertContains(basename(__FILE__), $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); + $this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition')); } public function testFileFromPathWithCustomizedFileName() @@ -269,8 +269,8 @@ abstract class ControllerTraitTest extends TestCase if ($response->headers->get('content-type')) { $this->assertSame('text/x-php', $response->headers->get('content-type')); } - $this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); - $this->assertContains('test.php', $response->headers->get('content-disposition')); + $this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition')); + $this->assertStringContainsString('test.php', $response->headers->get('content-disposition')); } public function testFileWhichDoesNotExist() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 8cfa3deff6..76d9d4ccfe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1079,9 +1079,9 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertSame('addYamlMappings', $calls[4][0]); $this->assertCount(3, $calls[4][1][0]); - $this->assertContains('foo.yml', $calls[4][1][0][0]); - $this->assertContains('validation.yml', $calls[4][1][0][1]); - $this->assertContains('validation.yaml', $calls[4][1][0][2]); + $this->assertStringContainsString('foo.yml', $calls[4][1][0][0]); + $this->assertStringContainsString('validation.yml', $calls[4][1][0][1]); + $this->assertStringContainsString('validation.yaml', $calls[4][1][0][2]); } public function testValidationAutoMapping() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php index 0cd9195d99..a47b78933b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php @@ -31,8 +31,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase $tester->execute(['pools' => ['cache.private_pool']], ['decorated' => false]); $this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success'); - $this->assertContains('Clearing cache pool: cache.private_pool', $tester->getDisplay()); - $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay()); + $this->assertStringContainsString('Clearing cache pool: cache.private_pool', $tester->getDisplay()); + $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay()); } public function testClearPublicPool() @@ -41,8 +41,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase $tester->execute(['pools' => ['cache.public_pool']], ['decorated' => false]); $this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success'); - $this->assertContains('Clearing cache pool: cache.public_pool', $tester->getDisplay()); - $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay()); + $this->assertStringContainsString('Clearing cache pool: cache.public_pool', $tester->getDisplay()); + $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay()); } public function testClearPoolWithCustomClearer() @@ -51,8 +51,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase $tester->execute(['pools' => ['cache.pool_with_clearer']], ['decorated' => false]); $this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success'); - $this->assertContains('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay()); - $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay()); + $this->assertStringContainsString('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay()); + $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay()); } public function testCallClearer() @@ -61,8 +61,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase $tester->execute(['pools' => ['cache.app_clearer']], ['decorated' => false]); $this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success'); - $this->assertContains('Calling cache clearer: cache.app_clearer', $tester->getDisplay()); - $this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay()); + $this->assertStringContainsString('Calling cache clearer: cache.app_clearer', $tester->getDisplay()); + $this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay()); } public function testClearUnexistingPool() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php index 290d9a85c1..d47aa9ba2e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php @@ -36,7 +36,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'TestBundle']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('custom: foo', $tester->getDisplay()); + $this->assertStringContainsString('custom: foo', $tester->getDisplay()); } public function testDumpBundleOption() @@ -45,7 +45,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'TestBundle', 'path' => 'custom']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('foo', $tester->getDisplay()); + $this->assertStringContainsString('foo', $tester->getDisplay()); } public function testParametersValuesAreResolved() @@ -54,8 +54,8 @@ class ConfigDebugCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'framework']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay()); - $this->assertContains('secret: test', $tester->getDisplay()); + $this->assertStringContainsString("locale: '%env(LOCALE)%'", $tester->getDisplay()); + $this->assertStringContainsString('secret: test', $tester->getDisplay()); } public function testDumpUndefinedBundleOption() @@ -63,7 +63,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase $tester = $this->createCommandTester(); $tester->execute(['name' => 'TestBundle', 'path' => 'foo']); - $this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay()); + $this->assertStringContainsString('Unable to find configuration for "test.foo"', $tester->getDisplay()); } public function testDumpWithPrefixedEnv() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php index b8ac6645f6..aa5dba65c0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDumpReferenceCommandTest.php @@ -36,8 +36,8 @@ class ConfigDumpReferenceCommandTest extends AbstractWebTestCase $ret = $tester->execute(['name' => 'TestBundle']); $this->assertSame(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('test:', $tester->getDisplay()); - $this->assertContains(' custom:', $tester->getDisplay()); + $this->assertStringContainsString('test:', $tester->getDisplay()); + $this->assertStringContainsString(' custom:', $tester->getDisplay()); } public function testDumpAtPath() @@ -70,7 +70,7 @@ EOL ]); $this->assertSame(1, $ret); - $this->assertContains('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay()); + $this->assertStringContainsString('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay()); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php index bb8fa9cfd3..b3327ed0ac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php @@ -45,7 +45,7 @@ class ContainerDebugCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:container']); - $this->assertContains('public', $tester->getDisplay()); + $this->assertStringContainsString('public', $tester->getDisplay()); } public function testPrivateAlias() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index af6228022e..b4ffba44e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -29,8 +29,8 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring']); - $this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); - $this->assertContains('(http_kernel)', $tester->getDisplay()); + $this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); + $this->assertStringContainsString('(http_kernel)', $tester->getDisplay()); } public function testSearchArgument() @@ -43,8 +43,8 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring', 'search' => 'kern']); - $this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); - $this->assertNotContains('Symfony\Component\Routing\RouterInterface', $tester->getDisplay()); + $this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay()); + $this->assertStringNotContainsString('Symfony\Component\Routing\RouterInterface', $tester->getDisplay()); } public function testSearchIgnoreBackslashWhenFindingService() @@ -69,7 +69,7 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'debug:autowiring', 'search' => 'foo_fake'], ['capture_stderr_separately' => true]); - $this->assertContains('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput()); + $this->assertStringContainsString('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput()); $this->assertEquals(1, $tester->getStatusCode()); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php index 0fa8a09b4b..c99b5e073e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SessionTest.php @@ -27,23 +27,23 @@ class SessionTest extends AbstractWebTestCase // no session $crawler = $client->request('GET', '/session'); - $this->assertContains('You are new here and gave no name.', $crawler->text()); + $this->assertStringContainsString('You are new here and gave no name.', $crawler->text()); // remember name $crawler = $client->request('GET', '/session/drak'); - $this->assertContains('Hello drak, nice to meet you.', $crawler->text()); + $this->assertStringContainsString('Hello drak, nice to meet you.', $crawler->text()); // prove remembered name $crawler = $client->request('GET', '/session'); - $this->assertContains('Welcome back drak, nice to meet you.', $crawler->text()); + $this->assertStringContainsString('Welcome back drak, nice to meet you.', $crawler->text()); // clear session $crawler = $client->request('GET', '/session_logout'); - $this->assertContains('Session cleared.', $crawler->text()); + $this->assertStringContainsString('Session cleared.', $crawler->text()); // prove cleared session $crawler = $client->request('GET', '/session'); - $this->assertContains('You are new here and gave no name.', $crawler->text()); + $this->assertStringContainsString('You are new here and gave no name.', $crawler->text()); } /** @@ -62,11 +62,11 @@ class SessionTest extends AbstractWebTestCase $crawler = $client->request('GET', '/session_setflash/Hello%20world.'); // check flash displays on redirect - $this->assertContains('Hello world.', $client->followRedirect()->text()); + $this->assertStringContainsString('Hello world.', $client->followRedirect()->text()); // check flash is gone $crawler = $client->request('GET', '/session_showflash'); - $this->assertContains('No flash was set.', $crawler->text()); + $this->assertStringContainsString('No flash was set.', $crawler->text()); } /** @@ -91,39 +91,39 @@ class SessionTest extends AbstractWebTestCase // new session, so no name set. $crawler1 = $client1->request('GET', '/session'); - $this->assertContains('You are new here and gave no name.', $crawler1->text()); + $this->assertStringContainsString('You are new here and gave no name.', $crawler1->text()); // set name of client1 $crawler1 = $client1->request('GET', '/session/client1'); - $this->assertContains('Hello client1, nice to meet you.', $crawler1->text()); + $this->assertStringContainsString('Hello client1, nice to meet you.', $crawler1->text()); // no session for client2 $crawler2 = $client2->request('GET', '/session'); - $this->assertContains('You are new here and gave no name.', $crawler2->text()); + $this->assertStringContainsString('You are new here and gave no name.', $crawler2->text()); // remember name client2 $crawler2 = $client2->request('GET', '/session/client2'); - $this->assertContains('Hello client2, nice to meet you.', $crawler2->text()); + $this->assertStringContainsString('Hello client2, nice to meet you.', $crawler2->text()); // prove remembered name of client1 $crawler1 = $client1->request('GET', '/session'); - $this->assertContains('Welcome back client1, nice to meet you.', $crawler1->text()); + $this->assertStringContainsString('Welcome back client1, nice to meet you.', $crawler1->text()); // prove remembered name of client2 $crawler2 = $client2->request('GET', '/session'); - $this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text()); + $this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text()); // clear client1 $crawler1 = $client1->request('GET', '/session_logout'); - $this->assertContains('Session cleared.', $crawler1->text()); + $this->assertStringContainsString('Session cleared.', $crawler1->text()); // prove client1 data is cleared $crawler1 = $client1->request('GET', '/session'); - $this->assertContains('You are new here and gave no name.', $crawler1->text()); + $this->assertStringContainsString('You are new here and gave no name.', $crawler1->text()); // prove remembered name of client2 remains untouched. $crawler2 = $client2->request('GET', '/session'); - $this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text()); + $this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text()); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php index a2b3327905..63581e131e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php @@ -72,7 +72,7 @@ class TemplateLocatorTest extends TestCase $locator->locate($template); $this->fail('->locate() should throw an exception when the file is not found.'); } catch (\InvalidArgumentException $e) { - $this->assertContains( + $this->assertStringContainsString( $errorMessage, $e->getMessage(), 'TemplateLocator exception should propagate the FileLocator exception message' diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php index a701c8e4ea..dc2aeaec50 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/CsrfFormLoginTest.php @@ -30,12 +30,12 @@ class CsrfFormLoginTest extends AbstractWebTestCase $crawler = $client->followRedirect(); $text = $crawler->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/profile".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/profile".', $text); $logoutLinks = $crawler->selectLink('Log out')->links(); $this->assertCount(2, $logoutLinks); - $this->assertContains('_csrf_token=', $logoutLinks[0]->getUri()); + $this->assertStringContainsString('_csrf_token=', $logoutLinks[0]->getUri()); $this->assertSame($logoutLinks[0]->getUri(), $logoutLinks[1]->getUri()); $client->click($logoutLinks[0]); @@ -57,7 +57,7 @@ class CsrfFormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/login'); $text = $client->followRedirect()->text(); - $this->assertContains('Invalid CSRF token.', $text); + $this->assertStringContainsString('Invalid CSRF token.', $text); } /** @@ -76,8 +76,8 @@ class CsrfFormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/foo'); $text = $client->followRedirect()->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/foo".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/foo".', $text); } /** @@ -97,8 +97,8 @@ class CsrfFormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/protected-resource'); $text = $client->followRedirect()->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/protected-resource".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/protected-resource".', $text); } public function getConfigs() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php index af932a3ce4..1959d05576 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FormLoginTest.php @@ -28,8 +28,8 @@ class FormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/profile'); $text = $client->followRedirect()->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/profile".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/profile".', $text); } /** @@ -49,8 +49,8 @@ class FormLoginTest extends AbstractWebTestCase $crawler = $client->followRedirect(); $text = $crawler->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/profile".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/profile".', $text); $logoutLinks = $crawler->selectLink('Log out')->links(); $this->assertCount(6, $logoutLinks); @@ -81,8 +81,8 @@ class FormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/foo'); $text = $client->followRedirect()->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/foo".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/foo".', $text); } /** @@ -102,8 +102,8 @@ class FormLoginTest extends AbstractWebTestCase $this->assertRedirect($client->getResponse(), '/protected_resource'); $text = $client->followRedirect()->text(); - $this->assertContains('Hello johannes!', $text); - $this->assertContains('You\'re browsing to path "/protected_resource".', $text); + $this->assertStringContainsString('Hello johannes!', $text); + $this->assertStringContainsString('You\'re browsing to path "/protected_resource".', $text); } public function getConfigs() diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php index 1860f95726..03da552254 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -51,7 +51,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase 'command' => 'security:encode-password', ], ['interactive' => false]); - $this->assertContains('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay()); $this->assertEquals($statusCode, 1); } @@ -68,7 +68,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 BCryptPasswordEncoder(17); preg_match('# Encoded password\s{1,}([\w+\/$.]+={0,2})\s+#', $output, $matches); @@ -92,7 +92,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 Argon2iPasswordEncoder(); preg_match('# Encoded password\s+(\$argon2id?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches); @@ -146,7 +146,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 Pbkdf2PasswordEncoder('sha512', true, 1000); preg_match('# Encoded password\s{1,}([\w+\/]+={0,2})\s+#', $output, $matches); @@ -165,9 +165,9 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase ], ['interactive' => false] ); - $this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay()); - $this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay()); - $this->assertContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); } public function testEncodePasswordEmptySaltOutput() @@ -179,9 +179,9 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase '--empty-salt' => true, ]); - $this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay()); - $this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay()); - $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); } public function testEncodePasswordNativeOutput() @@ -192,7 +192,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase 'user-class' => 'Custom\Class\Native\User', ], ['interactive' => false]); - $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); } /** @@ -211,7 +211,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase 'user-class' => 'Custom\Class\Argon2i\User', ], ['interactive' => false]); - $this->assertNotContains(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringNotContainsString(' Generated salt ', $this->passwordEncoderCommandTester->getDisplay()); } public function testEncodePasswordSodiumOutput() @@ -250,7 +250,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase 'password' => 'password', ], ['decorated' => false]); - $this->assertContains(<<assertStringContainsString(<< 'password', ], ['interactive' => false]); - $this->assertContains('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $this->passwordEncoderCommandTester->getDisplay()); + $this->assertStringContainsString('Encoder used Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder', $this->passwordEncoderCommandTester->getDisplay()); } public function testThrowsExceptionOnNoConfiguredEncoders() diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php index f1e7709072..e3451ccc31 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/NoTemplatingEntryTest.php @@ -27,7 +27,7 @@ class NoTemplatingEntryTest extends TestCase $container = $kernel->getContainer(); $content = $container->get('twig')->render('index.html.twig'); - $this->assertContains('{ a: b }', $content); + $this->assertStringContainsString('{ a: b }', $content); } protected function setUp() diff --git a/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile b/src/Symfony/Component/Config/Tests/Fixtures/Resource/.hiddenFile deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index 0c9cbc35f6..4653c8d7c7 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -24,28 +24,28 @@ class XmlUtilsTest extends TestCase XmlUtils::loadFile($fixtures.'invalid.xml'); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertContains('ERROR 77', $e->getMessage()); + $this->assertStringContainsString('ERROR 77', $e->getMessage()); } try { XmlUtils::loadFile($fixtures.'document_type.xml'); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertContains('Document types are not allowed', $e->getMessage()); + $this->assertStringContainsString('Document types are not allowed', $e->getMessage()); } try { XmlUtils::loadFile($fixtures.'invalid_schema.xml', $fixtures.'schema.xsd'); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertContains('ERROR 1845', $e->getMessage()); + $this->assertStringContainsString('ERROR 1845', $e->getMessage()); } try { XmlUtils::loadFile($fixtures.'invalid_schema.xml', 'invalid_callback_or_file'); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertContains('XSD file or callable', $e->getMessage()); + $this->assertStringContainsString('XSD file or callable', $e->getMessage()); } $mock = $this->getMockBuilder(__NAMESPACE__.'\Validator')->getMock(); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index e884369b59..c32578d8a6 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -184,7 +184,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['test']); - $this->assertContains('It works!', $tester->getDisplay(true)); + $this->assertStringContainsString('It works!', $tester->getDisplay(true)); } public function testAdd() @@ -753,7 +753,7 @@ class ApplicationTest extends TestCase $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exception'); $tester->run(['command' => 'foo'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE, 'capture_stderr_separately' => true]); - $this->assertContains('Exception trace', $tester->getErrorOutput(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); + $this->assertStringContainsString('Exception trace', $tester->getErrorOutput(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); $tester->run(['command' => 'list', '--foo' => true], ['decorated' => false, 'capture_stderr_separately' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getErrorOutput(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); @@ -890,7 +890,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 testRun() @@ -1315,7 +1315,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo']); - $this->assertContains('before.foo.error.after.', $tester->getDisplay()); + $this->assertStringContainsString('before.foo.error.after.', $tester->getDisplay()); } public function testRunDispatchesAllEventsWithExceptionInListener() @@ -1335,7 +1335,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo']); - $this->assertContains('before.error.after.', $tester->getDisplay()); + $this->assertStringContainsString('before.error.after.', $tester->getDisplay()); } public function testRunWithError() @@ -1383,7 +1383,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'foo']); - $this->assertContains('before.error.silenced.after.', $tester->getDisplay()); + $this->assertStringContainsString('before.error.silenced.after.', $tester->getDisplay()); $this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $tester->getStatusCode()); } @@ -1402,7 +1402,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'unknown']); - $this->assertContains('silenced command not found', $tester->getDisplay()); + $this->assertStringContainsString('silenced command not found', $tester->getDisplay()); $this->assertEquals(1, $tester->getStatusCode()); } @@ -1444,7 +1444,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'dym']); - $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); } public function testRunDispatchesAllEventsWithError() @@ -1461,7 +1461,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run(['command' => 'dym']); - $this->assertContains('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); + $this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events'); } public function testRunWithErrorFailingStatusCode() @@ -1493,7 +1493,7 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $exitCode = $tester->run(['command' => 'foo']); - $this->assertContains('before.after.', $tester->getDisplay()); + $this->assertStringContainsString('before.after.', $tester->getDisplay()); $this->assertEquals(ConsoleCommandEvent::RETURN_CODE_DISABLED, $exitCode); } @@ -1603,10 +1603,10 @@ class ApplicationTest extends TestCase $tester = new ApplicationTester($application); $tester->run([]); - $this->assertContains('called', $tester->getDisplay()); + $this->assertStringContainsString('called', $tester->getDisplay()); $tester->run(['--help' => true]); - $this->assertContains('The foo:bar command', $tester->getDisplay()); + $this->assertStringContainsString('The foo:bar command', $tester->getDisplay()); } /** diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 6eff68d94a..9ca4912f88 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -154,20 +154,20 @@ class CommandTest extends TestCase { $command = new \TestCommand(); $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); - $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly'); - $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%'); + $this->assertStringContainsString('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly'); + $this->assertStringNotContainsString('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%'); $command = new \TestCommand(); $command->setHelp(''); - $this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description'); + $this->assertStringContainsString('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description'); $command = new \TestCommand(); $command->setHelp('The %command.name% command does... Example: php %command.full_name%.'); $application = new Application(); $application->add($command); $application->setDefaultCommand('namespace:name', true); - $this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications'); - $this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications'); + $this->assertStringContainsString('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications'); + $this->assertStringNotContainsString('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications'); } public function testGetSetAliases() diff --git a/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php b/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php index ce9d8d4fe4..5b25550a6d 100644 --- a/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/HelpCommandTest.php @@ -25,9 +25,9 @@ class HelpCommandTest extends TestCase $command->setApplication(new Application()); $commandTester = new CommandTester($command); $commandTester->execute(['command_name' => 'li'], ['decorated' => false]); - $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); - $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); - $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); + $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias'); } public function testExecuteForCommand() @@ -36,9 +36,9 @@ class HelpCommandTest extends TestCase $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); $commandTester->execute([], ['decorated' => false]); - $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); } public function testExecuteForCommandWithXmlOption() @@ -47,7 +47,7 @@ class HelpCommandTest extends TestCase $commandTester = new CommandTester($command); $command->setCommand(new ListCommand()); $commandTester->execute(['--format' => 'xml']); - $this->assertContains('getDisplay(), '->execute() returns an XML help text if --xml is passed'); + $this->assertStringContainsString('getDisplay(), '->execute() returns an XML help text if --xml is passed'); } public function testExecuteForApplicationCommand() @@ -55,9 +55,9 @@ class HelpCommandTest extends TestCase $application = new Application(); $commandTester = new CommandTester($application->get('help')); $commandTester->execute(['command_name' => 'list']); - $this->assertContains('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('list [options] [--] []', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); } public function testExecuteForApplicationCommandWithXmlOption() @@ -65,7 +65,7 @@ class HelpCommandTest extends TestCase $application = new Application(); $commandTester = new CommandTester($application->get('help')); $commandTester->execute(['command_name' => 'list', '--format' => 'xml']); - $this->assertContains('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); - $this->assertContains('getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); + $this->assertStringContainsString('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); + $this->assertStringContainsString('getDisplay(), '->execute() returns an XML help text if --format=xml is passed'); } } diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php index d4559e8def..2bcbe51940 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php @@ -86,7 +86,7 @@ class OutputFormatterStyleTest extends TestCase $this->fail('->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); - $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); + $this->assertStringContainsString('Invalid option specified: "foo"', $e->getMessage(), '->setOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } try { @@ -94,7 +94,7 @@ class OutputFormatterStyleTest extends TestCase $this->fail('->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); - $this->assertContains('Invalid option specified: "foo"', $e->getMessage(), '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); + $this->assertStringContainsString('Invalid option specified: "foo"', $e->getMessage(), '->unsetOption() throws an \InvalidArgumentException when the option does not exist in the available options'); } } diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php index ffb12b3421..d608f7bfd2 100644 --- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php @@ -68,7 +68,7 @@ class HelperSetTest extends TestCase } catch (\Exception $e) { $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws InvalidArgumentException when helper not found'); $this->assertInstanceOf('Symfony\Component\Console\Exception\ExceptionInterface', $e, '->get() throws domain specific exception when helper not found'); - $this->assertContains('The helper "foo" is not defined.', $e->getMessage(), '->get() throws InvalidArgumentException when helper not found'); + $this->assertStringContainsString('The helper "foo" is not defined.', $e->getMessage(), '->get() throws InvalidArgumentException when helper not found'); } } diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index c073f30458..e6b0e2a68b 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -53,7 +53,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest rewind($output->getStream()); $stream = stream_get_contents($output->getStream()); - $this->assertContains('Input "Fabien" is not a superhero!', $stream); + $this->assertStringContainsString('Input "Fabien" is not a superhero!', $stream); try { $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '1'); diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php index a2d78621dd..cbf3b957b3 100644 --- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -161,6 +161,6 @@ class SymfonyQuestionHelperTest extends AbstractQuestionHelperTest { rewind($output->getStream()); $stream = stream_get_contents($output->getStream()); - $this->assertContains($expected, $stream); + $this->assertStringContainsString($expected, $stream); } } diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 9317602038..994a5efca1 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -305,7 +305,7 @@ class FlattenExceptionTest extends TestCase $flattened = FlattenException::create($exception); $trace = $flattened->getTrace(); - $this->assertContains('*DEEP NESTED ARRAY*', serialize($trace)); + $this->assertStringContainsString('*DEEP NESTED ARRAY*', serialize($trace)); } public function testTooBigArray() @@ -329,8 +329,8 @@ class FlattenExceptionTest extends TestCase $serializeTrace = serialize($trace); - $this->assertContains('*SKIPPED over 10000 entries*', $serializeTrace); - $this->assertNotContains('*value1*', $serializeTrace); + $this->assertStringContainsString('*SKIPPED over 10000 entries*', $serializeTrace); + $this->assertStringNotContainsString('*value1*', $serializeTrace); } public function testAnonymousClass() diff --git a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php index 3a9af8b6b8..dae390b8cb 100644 --- a/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php @@ -39,8 +39,8 @@ class ExceptionHandlerTest extends TestCase $handler->sendPhpResponse(new \RuntimeException('Foo')); $response = ob_get_clean(); - $this->assertContains('Whoops, looks like something went wrong.', $response); - $this->assertNotContains('
', $response); + $this->assertStringContainsString('Whoops, looks like something went wrong.', $response); + $this->assertStringNotContainsString('
', $response); $handler = new ExceptionHandler(true); @@ -48,8 +48,8 @@ class ExceptionHandlerTest extends TestCase $handler->sendPhpResponse(new \RuntimeException('Foo')); $response = ob_get_clean(); - $this->assertContains('

Foo

', $response); - $this->assertContains('
', $response); + $this->assertStringContainsString('

Foo

', $response); + $this->assertStringContainsString('
', $response); // taken from https://www.owasp.org/index.php/Cross-site_Scripting_(XSS) $htmlWithXss = ' click me! sendPhpResponse(new NotFoundHttpException('Foo')); $response = ob_get_clean(); - $this->assertContains('Sorry, the page you are looking for could not be found.', $response); + $this->assertStringContainsString('Sorry, the page you are looking for could not be found.', $response); $expectedHeaders = [ ['HTTP/1.0 404', true, null], @@ -166,7 +166,7 @@ content="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgndGVzdDMnKTwvc2NyaXB0Pg" private function assertThatTheExceptionWasOutput($content, $expectedClass, $expectedTitle, $expectedMessage) { - $this->assertContains(sprintf('%s', $expectedClass, $expectedTitle), $content); - $this->assertContains(sprintf('

%s

', $expectedMessage), $content); + $this->assertStringContainsString(sprintf('%s', $expectedClass, $expectedTitle), $content); + $this->assertStringContainsString(sprintf('

%s

', $expectedMessage), $content); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 8927dbcf45..c98275144e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -85,7 +85,7 @@ class MergeExtensionConfigurationPassTest extends TestCase $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false); + $this->assertContainsEquals(new FileResource(__FILE__), $container->getResources()); } public function testOverriddenEnvsAreMerged() diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index df9fcb7b57..0718c8ebef 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -462,7 +462,7 @@ class XmlFileLoaderTest extends TestCase $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); } // non-registered extension @@ -499,7 +499,7 @@ class XmlFileLoaderTest extends TestCase $e = $e->getPrevious(); $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); - $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertStringContainsString('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php index ccaa00b87c..25fd61cca2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php @@ -41,7 +41,7 @@ class EnvPlaceholderParameterBagTest extends TestCase $this->assertCount(1, $placeholderForVariable); $this->assertIsString($placeholder); - $this->assertContains($envVariableName, $placeholder); + $this->assertStringContainsString($envVariableName, $placeholder); } public function testMergeWhereFirstBagIsEmptyWillWork() @@ -64,7 +64,7 @@ class EnvPlaceholderParameterBagTest extends TestCase $this->assertCount(1, $placeholderForVariable); $this->assertIsString($placeholder); - $this->assertContains($envVariableName, $placeholder); + $this->assertStringContainsString($envVariableName, $placeholder); } public function testMergeWherePlaceholderOnlyExistsInSecond() diff --git a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php index fe0d3e6629..6eef4179e8 100644 --- a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php @@ -917,7 +917,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest $html = $this->renderWidget($form->createView()); // compare plain HTML to check the whitespace - $this->assertContains('
', $html); + $this->assertStringContainsString('
', $html); } public function testWidgetContainerAttributeNameRepeatedIfTrue() @@ -929,6 +929,6 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest $html = $this->renderWidget($form->createView()); // foo="foo" - $this->assertContains('
', $html); + $this->assertStringContainsString('
', $html); } } diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index b03ac0f9fc..8db5fde83f 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -2507,7 +2507,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase $html = $this->renderWidget($form->createView()); - $this->assertNotContains('foo="', $html); + $this->assertStringNotContainsString('foo="', $html); } public function testButtonAttributes() @@ -2543,7 +2543,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase $html = $this->renderWidget($form->createView()); - $this->assertNotContains('foo="', $html); + $this->assertStringNotContainsString('foo="', $html); } public function testTextareaWithWhitespaceOnlyContentRetainsValue() @@ -2552,7 +2552,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase $html = $this->renderWidget($form->createView()); - $this->assertContains('> ', $html); + $this->assertStringContainsString('> ', $html); } public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingForm() @@ -2563,7 +2563,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase $html = $this->renderForm($form->createView()); - $this->assertContains('> ', $html); + $this->assertStringContainsString('> ', $html); } public function testWidgetContainerAttributeHiddenIfFalse() @@ -2575,7 +2575,7 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase $html = $this->renderWidget($form->createView()); // no foo - $this->assertNotContains('foo="', $html); + $this->assertStringNotContainsString('foo="', $html); } public function testTranslatedAttributes() diff --git a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php index 7cc68bd83d..6240ad2316 100644 --- a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php @@ -519,7 +519,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest $html = $this->renderWidget($form->createView()); // compare plain HTML to check the whitespace - $this->assertContains('', $html); + $this->assertStringContainsString('
', $html); } public function testWidgetContainerAttributeNameRepeatedIfTrue() @@ -531,6 +531,6 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest $html = $this->renderWidget($form->createView()); // foo="foo" - $this->assertContains('
', $html); + $this->assertStringContainsString('
', $html); } } diff --git a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php index 8f2669c34b..20a9452369 100644 --- a/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php +++ b/src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php @@ -31,7 +31,7 @@ class DebugCommandTest extends TestCase $ret = $tester->execute([], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Built-in form types', $tester->getDisplay()); + $this->assertStringContainsString('Built-in form types', $tester->getDisplay()); } public function testDebugDeprecatedDefaults() @@ -63,7 +63,7 @@ TXT $ret = $tester->execute(['class' => 'FormType'], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (Block prefix: "form")', $tester->getDisplay()); + $this->assertStringContainsString('Symfony\Component\Form\Extension\Core\Type\FormType (Block prefix: "form")', $tester->getDisplay()); } public function testDebugDateTimeType() @@ -81,7 +81,7 @@ TXT $ret = $tester->execute(['class' => 'FormType', 'option' => 'method'], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); - $this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (method)', $tester->getDisplay()); + $this->assertStringContainsString('Symfony\Component\Form\Extension\Core\Type\FormType (method)', $tester->getDisplay()); } public function testDebugSingleFormTypeNotFound() diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php index 8c72b46bbc..9cadc9cd74 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php @@ -32,11 +32,11 @@ class CountryTypeTest extends BaseTypeTest ->createView()->vars['choices']; // Don't check objects for identity - $this->assertContains(new ChoiceView('DE', 'DE', 'Germany'), $choices, '', false, false); - $this->assertContains(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices, '', false, false); - $this->assertContains(new ChoiceView('US', 'US', 'United States'), $choices, '', false, false); - $this->assertContains(new ChoiceView('FR', 'FR', 'France'), $choices, '', false, false); - $this->assertContains(new ChoiceView('MY', 'MY', 'Malaysia'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('DE', 'DE', 'Germany'), $choices); + $this->assertContainsEquals(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices); + $this->assertContainsEquals(new ChoiceView('US', 'US', 'United States'), $choices); + $this->assertContainsEquals(new ChoiceView('FR', 'FR', 'France'), $choices); + $this->assertContainsEquals(new ChoiceView('MY', 'MY', 'Malaysia'), $choices); } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php index a02bae031a..7a8c1509ba 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php @@ -31,9 +31,9 @@ class CurrencyTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('EUR', 'EUR', 'Euro'), $choices, '', false, false); - $this->assertContains(new ChoiceView('USD', 'USD', 'US Dollar'), $choices, '', false, false); - $this->assertContains(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('EUR', 'EUR', 'Euro'), $choices); + $this->assertContainsEquals(new ChoiceView('USD', 'USD', 'US Dollar'), $choices); + $this->assertContainsEquals(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices); } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php index 7f25c8dab7..960aef1994 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php @@ -31,11 +31,11 @@ class LanguageTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_US', 'en_US', 'American English'), $choices, '', false, false); - $this->assertContains(new ChoiceView('fr', 'fr', 'French'), $choices, '', false, false); - $this->assertContains(new ChoiceView('my', 'my', 'Burmese'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices); + $this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices); + $this->assertContainsEquals(new ChoiceView('en_US', 'en_US', 'American English'), $choices); + $this->assertContainsEquals(new ChoiceView('fr', 'fr', 'French'), $choices); + $this->assertContainsEquals(new ChoiceView('my', 'my', 'Burmese'), $choices); } /** @@ -61,7 +61,7 @@ class LanguageTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE, 'language') ->createView()->vars['choices']; - $this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false); + $this->assertNotContainsEquals(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices); } public function testSubmitNull($expected = null, $norm = null, $view = null) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php index 484d9cede8..c5ba0da691 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php @@ -31,9 +31,9 @@ class LocaleTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false); - $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices, '', false, false); - $this->assertContains(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices); + $this->assertContainsEquals(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices); + $this->assertContainsEquals(new ChoiceView('zh_Hant_HK', 'zh_Hant_HK', 'Chinese (Traditional, Hong Kong SAR China)'), $choices); } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php index 2d1fadf7d2..e205529fe8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php @@ -23,8 +23,8 @@ class TimezoneTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Africa / Kinshasa'), $choices, '', false, false); - $this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'America / New York'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Africa / Kinshasa'), $choices); + $this->assertContainsEquals(new ChoiceView('America/New_York', 'America/New_York', 'America / New York'), $choices); } public function testSubmitNull($expected = null, $norm = null, $view = null) @@ -69,7 +69,7 @@ class TimezoneTypeTest extends BaseTypeTest $form->submit('Europe/Saratov'); $this->assertEquals(new \DateTimeZone('Europe/Saratov'), $form->getData()); - $this->assertContains('Europe/Saratov', $form->getConfig()->getAttribute('choice_list')->getValues()); + $this->assertStringContainsString('Europe/Saratov', $form->getConfig()->getAttribute('choice_list')->getValues()); } /** @@ -81,7 +81,7 @@ class TimezoneTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE, null, ['regions' => \DateTimeZone::EUROPE]) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Europe / Amsterdam'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Europe / Amsterdam'), $choices); } /** @@ -170,8 +170,8 @@ class TimezoneTypeTest extends BaseTypeTest $choices = $this->factory->create(static::TESTED_TYPE, null, ['intl' => true]) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Central European Time (Amsterdam)'), $choices, '', false, false); - $this->assertContains(new ChoiceView('Etc/UTC', 'Etc/UTC', 'Coordinated Universal Time'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'Central European Time (Amsterdam)'), $choices); + $this->assertContainsEquals(new ChoiceView('Etc/UTC', 'Etc/UTC', 'Coordinated Universal Time'), $choices); } /** @@ -186,8 +186,8 @@ class TimezoneTypeTest extends BaseTypeTest ]) ->createView()->vars['choices']; - $this->assertContains(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'за центральноєвропейським часом (Амстердам)'), $choices, '', false, false); - $this->assertContains(new ChoiceView('Etc/UTC', 'Etc/UTC', 'за всесвітнім координованим часом'), $choices, '', false, false); + $this->assertContainsEquals(new ChoiceView('Europe/Amsterdam', 'Europe/Amsterdam', 'за центральноєвропейським часом (Амстердам)'), $choices); + $this->assertContainsEquals(new ChoiceView('Etc/UTC', 'Etc/UTC', 'за всесвітнім координованим часом'), $choices); } public function testChoiceTranslationLocaleOptionWithoutIntl() diff --git a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php index b4e5a26407..ab527b6999 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php @@ -261,7 +261,7 @@ class BinaryFileResponseTest extends ResponseTestCase $this->expectOutputString(''); $response->sendContent(); - $this->assertContains('README.md', $response->headers->get('X-Sendfile')); + $this->assertStringContainsString('README.md', $response->headers->get('X-Sendfile')); } public function provideXSendfileFiles() diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php index eaea69a7d9..61a278e656 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php @@ -116,7 +116,7 @@ class CookieTest extends TestCase $cookie = Cookie::create('foo', 'bar', $value); $expire = strtotime($value); - $this->assertEquals($expire, $cookie->getExpiresTime(), '->getExpiresTime() returns the expire date', 1); + $this->assertEqualsWithDelta($expire, $cookie->getExpiresTime(), 1, '->getExpiresTime() returns the expire date'); } public function testGetDomain() diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index d7b8f2d78b..414868925a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -1630,14 +1630,14 @@ class RequestTest extends TestCase $asString = (string) $request; - $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString); - $this->assertContains('Cookie: Foo=Bar', $asString); + $this->assertStringContainsString('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $asString); + $this->assertStringContainsString('Cookie: Foo=Bar', $asString); $request->cookies->set('Another', 'Cookie'); $asString = (string) $request; - $this->assertContains('Cookie: Foo=Bar; Another=Cookie', $asString); + $this->assertStringContainsString('Cookie: Foo=Bar; Another=Cookie', $asString); } public function testIsMethod() diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 24f5df1c40..8609fa7231 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -601,7 +601,7 @@ class ResponseTest extends ResponseTestCase $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported'); } catch (\Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported'); - $this->assertContains('"wrong option"', $e->getMessage()); + $this->assertStringContainsString('"wrong option"', $e->getMessage()); } $options = ['etag' => '"whatever"']; @@ -654,7 +654,7 @@ class ResponseTest extends ResponseTestCase ob_start(); $response->sendContent(); $string = ob_get_clean(); - $this->assertContains('test response rendering', $string); + $this->assertStringContainsString('test response rendering', $string); } public function testSetPublic() diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index a9440630e6..68b00a027c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -199,7 +199,7 @@ class RouterListenerTest extends TestCase $request = Request::create('http://localhost/'); $response = $kernel->handle($request); $this->assertSame(404, $response->getStatusCode()); - $this->assertContains('Welcome', $response->getContent()); + $this->assertStringContainsString('Welcome', $response->getContent()); } public function testRequestWithBadHost() diff --git a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php index 9b7fe08a99..b2eb59206b 100644 --- a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php @@ -20,9 +20,9 @@ class UriSignerTest extends TestCase { $signer = new UriSigner('foobar'); - $this->assertContains('?_hash=', $signer->sign('http://example.com/foo')); - $this->assertContains('?_hash=', $signer->sign('http://example.com/foo?foo=bar')); - $this->assertContains('&foo=', $signer->sign('http://example.com/foo?foo=bar')); + $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo')); + $this->assertStringContainsString('?_hash=', $signer->sign('http://example.com/foo?foo=bar')); + $this->assertStringContainsString('&foo=', $signer->sign('http://example.com/foo?foo=bar')); } public function testCheck() diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 464a0aac0c..9e8499eba9 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -806,7 +806,7 @@ abstract class AbstractNumberFormatterTest extends TestCase { $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE); - $this->assertEquals($expectedValue, $parsedValue, '', 0.001); + $this->assertEqualsWithDelta($expectedValue, $parsedValue, 0.001); } public function parseTypeDoubleProvider() diff --git a/src/Symfony/Component/Process/Tests/PhpProcessTest.php b/src/Symfony/Component/Process/Tests/PhpProcessTest.php index 0355c85be6..b7b21ebcb1 100644 --- a/src/Symfony/Component/Process/Tests/PhpProcessTest.php +++ b/src/Symfony/Component/Process/Tests/PhpProcessTest.php @@ -39,10 +39,10 @@ PHP $commandLine = $process->getCommandLine(); $process->start(); - $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start'); + $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after start'); $process->wait(); - $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); + $this->assertStringContainsString($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); $this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput()); } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php index 9d789e5fde..8ec92d5014 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Provider/UserAuthenticationProviderTest.php @@ -211,8 +211,8 @@ class UserAuthenticationProviderTest extends TestCase $this->assertInstanceOf('Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken', $authToken); $this->assertSame($user, $authToken->getUser()); - $this->assertContains('ROLE_FOO', $authToken->getRoleNames(), '', false, false); - $this->assertContains($switchUserRole, $authToken->getRoles(), '', false, false); + $this->assertContains('ROLE_FOO', $authToken->getRoleNames()); + $this->assertContains($switchUserRole, $authToken->getRoles()); $this->assertEquals('foo', $authToken->getCredentials()); $this->assertEquals(['foo' => 'bar'], $authToken->getAttributes(), '->authenticate() copies token attributes'); } @@ -240,7 +240,7 @@ class UserAuthenticationProviderTest extends TestCase $this->assertInstanceOf(SwitchUserToken::class, $authToken); $this->assertSame($originalToken, $authToken->getOriginalToken()); $this->assertSame($user, $authToken->getUser()); - $this->assertContains('ROLE_FOO', $authToken->getRoleNames(), '', false, false); + $this->assertContains('ROLE_FOO', $authToken->getRoleNames()); $this->assertEquals('foo', $authToken->getCredentials()); $this->assertEquals(['foo' => 'bar'], $authToken->getAttributes(), '->authenticate() copies token attributes'); } diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php index c8ab4f0bea..ca28b58fe6 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php @@ -73,7 +73,7 @@ class StopwatchEventTest extends TestCase $event->start(); usleep(200000); $event->stop(); - $this->assertEquals(200, $event->getDuration(), '', self::DELTA); + $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA); $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); @@ -83,7 +83,7 @@ class StopwatchEventTest extends TestCase $event->start(); usleep(100000); $event->stop(); - $this->assertEquals(200, $event->getDuration(), '', self::DELTA); + $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA); } public function testDurationBeforeStop() @@ -91,7 +91,7 @@ class StopwatchEventTest extends TestCase $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); usleep(200000); - $this->assertEquals(200, $event->getDuration(), '', self::DELTA); + $this->assertEqualsWithDelta(200, $event->getDuration(), self::DELTA); $event = new StopwatchEvent(microtime(true) * 1000); $event->start(); @@ -100,7 +100,7 @@ class StopwatchEventTest extends TestCase usleep(50000); $event->start(); usleep(100000); - $this->assertEquals(100, $event->getDuration(), '', self::DELTA); + $this->assertEqualsWithDelta(100, $event->getDuration(), self::DELTA); } public function testStopWithoutStart() @@ -132,7 +132,7 @@ class StopwatchEventTest extends TestCase $event->start(); usleep(100000); $event->ensureStopped(); - $this->assertEquals(300, $event->getDuration(), '', self::DELTA); + $this->assertEqualsWithDelta(300, $event->getDuration(), self::DELTA); } public function testStartTime() @@ -149,7 +149,7 @@ class StopwatchEventTest extends TestCase $event->start(); usleep(100000); $event->stop(); - $this->assertEquals(0, $event->getStartTime(), '', self::DELTA); + $this->assertEqualsWithDelta(0, $event->getStartTime(), self::DELTA); } public function testHumanRepresentation() diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index f257a36361..a75c5f9f5a 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -60,7 +60,7 @@ bar'; $ret = $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); + $this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay())); } public function testConstantAsKey() diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 7f4959e95c..1b899fd54e 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -101,7 +101,7 @@ class InlineTest extends TestCase } $this->assertEquals('1.2', Inline::dump(1.2)); - $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); + $this->assertStringContainsStringIgnoringCase('fr', setlocale(LC_NUMERIC, 0)); } finally { setlocale(LC_NUMERIC, $locale); }