You are here

public function BlazyManagerTest::testPreprocessResponsiveImage in Blazy 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/BlazyManagerTest.php \Drupal\Tests\blazy\Kernel\BlazyManagerTest::testPreprocessResponsiveImage()

Tests responsive image integration.

@dataProvider providerResponsiveImage

Parameters

string $responsive_image_style_id: The responsive_image_style_id.

bool $expected: The expected output_image_tag.

File

tests/src/Kernel/BlazyManagerTest.php, line 198

Class

BlazyManagerTest
Tests the Blazy manager methods.

Namespace

Drupal\Tests\blazy\Kernel

Code

public function testPreprocessResponsiveImage($responsive_image_style_id, $expected) {
  $variables = [
    'item' => $this->testItem,
    'uri' => $this->uri,
    'responsive_image_style_id' => $responsive_image_style_id,
    'width' => 600,
    'height' => 480,
  ];
  template_preprocess_responsive_image($variables);
  $variables['img_element']['#uri'] = $this->uri;
  Blazy::preprocessResponsiveImage($variables);
  $this
    ->assertEquals($expected, $variables['output_image_tag']);
}