diff -u b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php --- b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php @@ -18,23 +18,28 @@ * * @var array */ - public static $modules = array('image', 'image_module_test', 'language'); + public static $modules = ['image', 'image_module_test', 'language']; /** + * The image style. + * * @var \Drupal\image\ImageStyleInterface */ protected $style; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->style = ImageStyle::create([ 'name' => 'style_foo', - 'label' => $this->randomString() + 'label' => $this->randomString(), ]); $this->style->save(); - // Create a new language + // Create a new language. ConfigurableLanguage::createFromLangcode('fr')->save(); } @@ -83,14 +88,14 @@ /** * Tests an image style URL with the "public://" schema and language prefix. */ - function testImageStyleUrlAndPathPublicLanguage() { + public function testImageStyleUrlAndPathPublicLanguage() { $this->doImageStyleUrlAndPathTests('public', TRUE, TRUE, 'fr'); } /** * Tests an image style URL with the "private://" schema and language prefix. */ - function testImageStyleUrlAndPathPrivateLanguage() { + public function testImageStyleUrlAndPathPrivateLanguage() { $this->doImageStyleUrlAndPathTests('private', TRUE, TRUE, 'fr'); } @@ -114,7 +119,7 @@ /** * Tests building an image style URL. */ - function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = FALSE, $langcode = FALSE) { + public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = FALSE, $langcode = FALSE) { $this->prepareRequestForGenerator($clean_url); // Make the default scheme neither "public" nor "private" to verify the @@ -126,7 +131,7 @@ $status = file_prepare_directory($directory, FILE_CREATE_DIRECTORY); $this->assertNotIdentical(FALSE, $status, 'Created the directory for the generated images for the test style.'); - // Override the language to build the URL for the correct language + // Override the language to build the URL for the correct language. if ($langcode) { $language_manager = \Drupal::service('language_manager'); $language = $language_manager->getLanguage($langcode); @@ -147,7 +152,7 @@ $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $generate_url = $this->style->buildUrl($original_uri, $clean_url); - // Make sure that language prefix is never added to the image style URL.q + // Make sure that language prefix is never added to the image style URL. if ($langcode) { $this->assertTrue(strpos($generate_url, "/$langcode/") === FALSE, 'Langcode was not found in the image style URL.'); } @@ -226,13 +231,15 @@ $this->drupalGet($generate_url_noaccess); $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. + // Verify that images are not appended to the response. + // Currently this test only uses PNG images. if (strpos($generate_url, '.png') === FALSE) { $this->fail('Confirming that private image styles are not appended require PNG file.'); } else { - // Check for PNG-Signature (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) in the - // response body. + // Check for PNG-Signature + // (cf. http://www.libpng.org/pub/png/book/chapter08.html#png.ch08.div.2) + // in the response body. $this->assertNoRaw(chr(137) . chr(80) . chr(78) . chr(71) . chr(13) . chr(10) . chr(26) . chr(10), 'No PNG signature found in the response body.'); } }