From e4d8c27c20816b681ac5240a92cd5cd45a588dea Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Wed, 8 Apr 2020 18:29:31 +0200 Subject: [PATCH] [Testing] Change deprecated assertContains to assertStringContainsString --- console.rst | 2 +- create_framework/unit_testing.rst | 4 ++-- testing.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/console.rst b/console.rst index 8b7b38b0d46..ffc981961aa 100644 --- a/console.rst +++ b/console.rst @@ -356,7 +356,7 @@ console:: // the output of the command in the console $output = $commandTester->getDisplay(); - $this->assertContains('Username: Wouter', $output); + $this->assertStringContainsString('Username: Wouter', $output); // ... } diff --git a/create_framework/unit_testing.rst b/create_framework/unit_testing.rst index 099ada7e704..a4d6d401c33 100644 --- a/create_framework/unit_testing.rst +++ b/create_framework/unit_testing.rst @@ -49,7 +49,7 @@ resolver. Modify the framework to make use of them:: namespace Simplex; // ... - + use Calendar\Controller\LeapYearController; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; @@ -183,7 +183,7 @@ Response:: $response = $framework->handle(new Request()); $this->assertEquals(200, $response->getStatusCode()); - $this->assertContains('Yep, this is a leap year!', $response->getContent()); + $this->assertStringContainsString('Yep, this is a leap year!', $response->getContent()); } In this test, we simulate a route that matches and returns a simple diff --git a/testing.rst b/testing.rst index a74ef6b4325..40b08c0f98d 100644 --- a/testing.rst +++ b/testing.rst @@ -270,7 +270,7 @@ Or test against the response content directly if you just want to assert that the content contains some text or in case that the response is not an XML/HTML document:: - $this->assertContains( + $this->assertStringContainsString( 'Hello World', $client->getResponse()->getContent() ); @@ -316,7 +316,7 @@ document:: ); // asserts that the response content contains a string - $this->assertContains('foo', $client->getResponse()->getContent()); + $this->assertStringContainsString('foo', $client->getResponse()->getContent()); // ...or matches a regex $this->assertRegExp('/foo(bar)?/', $client->getResponse()->getContent());