You are here

function ImageStylesPathAndUrlTest::testImageStylePath 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::testImageStylePath()

Tests \Drupal\image\ImageStyleInterface::buildUri().

File

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

Class

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

Namespace

Drupal\image\Tests

Code

function testImageStylePath() {
  $scheme = 'public';
  $actual = $this->style
    ->buildUri("{$scheme}://foo/bar.gif");
  $expected = "{$scheme}://styles/" . $this->style
    ->id() . "/{$scheme}/foo/bar.gif";
  $this
    ->assertEqual($actual, $expected, 'Got the path for a file URI.');
  $actual = $this->style
    ->buildUri('foo/bar.gif');
  $expected = "{$scheme}://styles/" . $this->style
    ->id() . "/{$scheme}/foo/bar.gif";
  $this
    ->assertEqual($actual, $expected, 'Got the path for a relative file path.');
}