You are here

public function BlazyManagerUnitTest::testAttach in Blazy 8.2

Same name and namespace in other branches
  1. 8 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 156

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',
  ];
  $this->blazyManager
    ->expects($this
    ->any())
    ->method('attach')
    ->with($attach)
    ->willReturn([
    'drupalSettings' => [
      'blazy' => [],
    ],
  ]);
  $attachments = $this->blazyManager
    ->attach($attach);
  $this->blazyManager
    ->expects($this
    ->any())
    ->method('attach')
    ->with($attach)
    ->willReturn([
    'drupalSettings' => [
      'blazy' => [],
    ],
  ]);
  $this
    ->assertArrayHasKey('blazy', $attachments['drupalSettings']);
}