You are here

function ImageStylesPathAndUrlTest::testImageStyleUrlForMissingSourceImage in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php \Drupal\image\Tests\ImageStylesPathAndUrlTest::testImageStyleUrlForMissingSourceImage()

Tests that an invalid source image returns a 404.

File

core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php, line 90
Contains \Drupal\image\Tests\ImageStylesPathAndUrlTest.

Class

ImageStylesPathAndUrlTest
Tests the functions for generating paths and URLs for image styles.

Namespace

Drupal\image\Tests

Code

function testImageStyleUrlForMissingSourceImage() {
  $non_existent_uri = 'public://foo.png';
  $generated_url = $this->style
    ->buildUrl($non_existent_uri);
  $this
    ->drupalGet($generated_url);
  $this
    ->assertResponse(404, 'Accessing an image style URL with a source image that does not exist provides a 404 error response.');
}