You are here

public function BlazyGridUnitTest::testBuild in Blazy 8.2

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

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

@covers ::build

File

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

Class

BlazyGridUnitTest
@coversDefaultClass \Drupal\blazy\BlazyGrid

Namespace

Drupal\Tests\blazy\Unit

Code

public function testBuild() {
  $settings = BlazyDefault::htmlSettings();
  $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[] = [
      '#markup' => '<img src="/core/misc/druplicon.png" alt="thumbnail ' . $key . '">',
    ];
  }
  $element = BlazyGrid::build($items, $settings);
  $this
    ->assertEquals('item_list', $element['#theme']);
}