You are here

public function ImageStylesPathAndUrlTest::testImageStyleUrlForMissingSourceImage in Drupal 9

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

Tests that an invalid source image returns a 404.

File

core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php, line 125

Class

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

Namespace

Drupal\Tests\image\Functional

Code

public function testImageStyleUrlForMissingSourceImage() {
  $non_existent_uri = 'public://foo.png';
  $generated_url = $this->style
    ->buildUrl($non_existent_uri);
  $this
    ->drupalGet($generated_url);
  $this
    ->assertSession()
    ->statusCodeEquals(404);
}