You are here

public function BlazyGridUnitTest::testBuild in Blazy 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/BlazyGridUnitTest.php \Drupal\Tests\blazy\Unit\BlazyGridUnitTest::testBuild()

Tests \Drupal\blazy\BlazyGrid::build().

@covers ::build @covers ::buildGridItemAttributes

File

tests/src/Unit/BlazyGridUnitTest.php, line 21

Class

BlazyGridUnitTest
@coversDefaultClass \Drupal\blazy\BlazyGrid

Namespace

Drupal\Tests\blazy\Unit

Code

public function testBuild() {
  $settings['grid'] = 4;
  $settings['grid_medium'] = 3;
  $settings['grid_small'] = 2;
  $settings['grid_item_class'] = 'grid--test';
  $settings['image_style'] = 'blazy_crop';
  $settings['media_switch'] = 'media';
  $settings['style'] = 'grid';
  $settings['type'] = 'image';
  $items = [];
  foreach (range(1, 3) as $key) {
    $items[] = '<img src="/core/misc/druplicon.png" alt="thumbnail ' . $key . '">';
  }
  $element = BlazyGrid::build($items, $settings);
  $this
    ->assertEquals('item_list', $element['#theme']);
}