diff --git a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php index 678f3718..1cd7ce2e 100644 --- a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php @@ -465,7 +465,7 @@ public function testImageStyleUrlAndPath(string $scheme, bool $clean_url, bool $ // Make sure that language prefix is never added to the image style URL. if ($langcode) { - $this->assertNotContains("/$langcode/", $generate_url); + $this->assertStringNotContainsString("/$langcode/", $generate_url); } // Ensure that the tests still pass when the file is generated by accessing @@ -484,7 +484,7 @@ public function testImageStyleUrlAndPath(string $scheme, bool $clean_url, bool $ // When using non-clean URLS, the system path contains the script name. if (!$clean_url) { - $this->assertContains('index.php/', $generate_url); + $this->assertStringContainsString('index.php/', $generate_url); } // Add some extra chars to the token. @@ -525,7 +525,7 @@ public function testImageStyleUrlAndPath(string $scheme, bool $clean_url, bool $ if ($scheme == 'private') { $this->assertSame('Sun, 19 Nov 1978 05:00:00 GMT', $this->drupalGetHeader('Expires')); - $this->assertContains('no-cache', $this->drupalGetHeader('Cache-Control')); + $this->assertStringContainsString('no-cache', $this->drupalGetHeader('Cache-Control')); $this->assertSame('image_module_test', $this->drupalGetHeader('X-Image-Owned-By')); // Make sure that a second request to the already existing derivative @@ -560,16 +560,16 @@ public function testImageStyleUrlAndPath(string $scheme, bool $clean_url, bool $ $this->assertResponse(403, 'Confirmed that access is denied for the private image style.'); // Verify that images are not appended to the response. // Currently this test only uses PNG images. - $this->assertContains('.png', $generate_url, 'Confirming that private image styles are not appended require PNG file.'); + $this->assertStringContainsString('.png', $generate_url, 'Confirming that private image styles are not appended require PNG file.'); // Check for PNG-Signature // (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) // in the response body. $raw = $this->getSession()->getPage()->getContent(); - $this->assertNotContains(chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), $raw); + $this->assertStringNotContainsString(chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), $raw); } else { $this->assertSame('Sun, 19 Nov 1978 05:00:00 GMT', $this->drupalGetHeader('Expires'), 'Expires header was sent.'); - $this->assertNotContains('no-cache', $this->drupalGetHeader('Cache-Control')); + $this->assertStringNotContainsString('no-cache', $this->drupalGetHeader('Cache-Control')); if ($clean_url) { // Add some extra chars to the token. @@ -603,7 +603,7 @@ public function testImageStyleUrlAndPath(string $scheme, bool $clean_url, bool $ $generated_uri = $pipeline->getDerivativeImageUri(); $this->assertFileNotExists($generated_uri, 'Generated file does not exist.'); $generate_url = $pipeline->getDerivativeImageUrl()->toString(); - $this->assertNotContains(IMAGE_DERIVATIVE_TOKEN . '=', $generate_url, 'The security token does not appear in the image style URL.'); + $this->assertStringNotContainsString(IMAGE_DERIVATIVE_TOKEN . '=', $generate_url, 'The security token does not appear in the image style URL.'); $this->drupalGet($generate_url); $this->assertResponse(200, 'Image was accessible at the URL with a missing token.'); diff --git a/core/modules/image/tests/src/Kernel/DerivativeImageProcessTest.php b/core/modules/image/tests/src/Kernel/DerivativeImageProcessTest.php index 24f7c5ba..5f9627be 100644 --- a/core/modules/image/tests/src/Kernel/DerivativeImageProcessTest.php +++ b/core/modules/image/tests/src/Kernel/DerivativeImageProcessTest.php @@ -36,7 +36,7 @@ class DerivativeImageProcessTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->installConfig(['system', 'image']); $this->imageProcessor = \Drupal::service('image.processor'); diff --git a/core/modules/image/tests/src/Kernel/ImageStyleLegacyTest.php b/core/modules/image/tests/src/Kernel/ImageStyleLegacyTest.php index 3f6e7700..7f4dbccf 100644 --- a/core/modules/image/tests/src/Kernel/ImageStyleLegacyTest.php +++ b/core/modules/image/tests/src/Kernel/ImageStyleLegacyTest.php @@ -33,7 +33,7 @@ class ImageStyleLegacyTest extends KernelTestBase { /** * {@inheritdoc} */ - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->imageStyle = ImageStyle::create([ @@ -58,7 +58,7 @@ public function testBuildUri() { * @expectedDeprecation The Drupal\image\Entity\ImageStyle::buildUrl method is deprecated since version 9.x.x and will be removed in y.y.y. */ public function testBuildUrl() { - $this->assertContains('files/styles/test/public/test.png?itok=', $this->imageStyle->buildUrl('public://test.png')); + $this->assertStringContainsString('files/styles/test/public/test.png?itok=', $this->imageStyle->buildUrl('public://test.png')); } /** @@ -66,7 +66,7 @@ public function testBuildUrl() { * @expectedDeprecation The Drupal\image\Entity\ImageStyle::createDerivative method is deprecated since version 9.x.x and will be removed in y.y.y. */ public function testCreateDerivative() { - $this->assertInternalType('bool', $this->imageStyle->createDerivative('public://test.png', 'public://test_derivative.png')); + $this->assertIsBool($this->imageStyle->createDerivative('public://test.png', 'public://test_derivative.png')); } /**