function HtmxRequestInfoTest::testGetHtmxCurrentUrl
Tests the getHtmxCurrentUrl method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxRequestInfoTest.php, line 62
Class
- HtmxRequestInfoTest
- Test all HtmxRequestInfoTrait methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testGetHtmxCurrentUrl() : void {
// Test with the header not present.
$this->assertEquals('', $this->getHtmxCurrentUrl());
// Test with the header present.
$this->request->headers
->set('HX-Current-URL', 'https://example.com/page');
$this->assertEquals('https://example.com/page', $this->getHtmxCurrentUrl());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.