function ImageStylesPathAndUrlTest::testImageStylePath

Test image_style_path().

File

drupal/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php, line 47
Definition of 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 = image_style_path($this->style_name, "{$scheme}://foo/bar.gif");
  $expected = "{$scheme}://styles/" . $this->style_name . "/{$scheme}/foo/bar.gif";
  $this
    ->assertEqual($actual, $expected, 'Got the path for a file URI.');
  $actual = image_style_path($this->style_name, 'foo/bar.gif');
  $expected = "{$scheme}://styles/" . $this->style_name . "/{$scheme}/foo/bar.gif";
  $this
    ->assertEqual($actual, $expected, 'Got the path for a relative file path.');
}