You are here

public function HideModifierTest::testModification in Modifiers Pack 8

@covers ::modification

File

modules/modifiers_hide/tests/src/Unit/HideModifierTest.php, line 17

Class

HideModifierTest
@coversDefaultClass \Drupal\modifiers_hide\Plugin\modifiers\HideModifier @group modifiers_pack

Namespace

Drupal\Tests\modifiers_hide\Unit

Code

public function testModification() {

  // Well-formed boolean value.
  $actual_1 = HideModifier::modification('.selector', [
    'hide' => '1',
  ]);
  $expected_css_1 = [
    'all' => [
      '.selector' => [
        'display:none',
      ],
    ],
  ];
  $this
    ->assertEquals($expected_css_1, $actual_1
    ->getCss());
  $this
    ->assertEmpty($actual_1
    ->getLibraries());
  $this
    ->assertEmpty($actual_1
    ->getSettings());
  $this
    ->assertEmpty($actual_1
    ->getAttributes());
  $this
    ->assertEmpty($actual_1
    ->getLinks());

  // Mall-formed boolean value.
  $actual_2 = HideModifier::modification('.selector', [
    'hide' => '2',
  ]);
  $this
    ->assertEmpty($actual_2);
}