function HtmxHeadersTest::testPushUrlHeader
Test push url header with a simple URL object.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxHeadersTest.php, line 99
Class
- HtmxHeadersTest
- Test all header-related Htmx public methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testPushUrlHeader() : void {
$this->htmx
->pushUrlHeader($this->url);
$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-push-url', $value[0]);
$this->assertEquals('https://www.example.test/common-test/destination', $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.