function HtmxHeadersTest::testReswapHeader

Test re-swap header.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxHeadersTest.php, line 165

Class

HtmxHeadersTest
Test all header-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testReswapHeader() : void {
  $this->htmx
    ->reswapHeader('foo');
  $render = $this->apply();
  $this->assertTrue(isset($render['#attached']['http_header']));
  $this->assertIsArray($render['#attached']['http_header']);
  $value = reset($render['#attached']['http_header']);
  $this->assertEquals('hx-reswap', $value[0]);
  $this->assertEquals('foo', $value[1]);
  $this->assertEquals(TRUE, $value[2]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.