You are here

public function BlazyManagerUnitTest::testAttach in Blazy 8

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

Tests cases for attachments.

@covers ::attach @depends testConfigLoad

File

tests/src/Unit/BlazyManagerUnitTest.php, line 205

Class

BlazyManagerUnitTest
@coversDefaultClass \Drupal\blazy\BlazyManager

Namespace

Drupal\Tests\blazy\Unit

Code

public function testAttach() {
  $attach = [
    'blazy' => TRUE,
    'grid' => 0,
    'media' => TRUE,
    'media_switch' => 'media',
    'ratio' => 'fluid',
    'style' => 'column',
  ];
  $attachments = $this->blazyManager
    ->attach($attach);
  $this
    ->assertArrayHasKey('library', $attachments);
  $this
    ->assertArrayHasKey('blazy', $attachments['drupalSettings']);
  $this
    ->assertContains('blazy/media', $attachments['library']);
  $this
    ->assertContains('blazy/ratio', $attachments['library']);
}