You are here

public function BlazyUnitTest::testBuildIframeAttributes in Blazy 8

Tests \Drupal\blazy\Blazy\buildIframeAttributes.

@covers ::buildIframeAttributes @covers \Drupal\blazy\Dejavu\BlazyDefault::entitySettings @dataProvider providerTestBuildIframeAttributes

Parameters

array $data: The input data which can be string, or integer.

mixed|bool|int $expected: The expected output.

File

tests/src/Unit/BlazyUnitTest.php, line 75

Class

BlazyUnitTest
@coversDefaultClass \Drupal\blazy\Blazy

Namespace

Drupal\Tests\blazy\Unit

Code

public function testBuildIframeAttributes(array $data, $expected) {
  $variables = [
    'attributes' => [],
    'image' => [],
  ];
  $settings = BlazyDefault::entitySettings();
  $settings['embed_url'] = '//www.youtube.com/watch?v=E03HFA923kw';
  $settings['scheme'] = 'youtube';
  $settings['type'] = 'video';
  $this
    ->assertArrayHasKey('iframe_lazy', $settings);
  $variables['settings'] = array_merge($settings, $data);
  Blazy::buildIframeAttributes($variables);
  $this
    ->assertNotEmpty($variables[$expected]);
}