function ImageStylesPathAndUrlTestCase::testImageStyleUrlForMissingSourceImage

Test that an invalid source image returns a 404.

File

modules/image/image.test, line 202

Class

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

Code

function testImageStyleUrlForMissingSourceImage() {
  $non_existent_uri = 'public://foo.png';
  $generated_url = image_style_url($this->style_name, $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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.