function HtmxRequestInfoTest::testIsHtmxHistoryRestoration

Tests the isHtmxHistoryRestoration method.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php, line 74

Class

HtmxRequestInfoTest
Test all HtmxRequestInfoTrait methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testIsHtmxHistoryRestoration() : void {
  // Test with the header not present.
  $this->assertFalse($this->isHtmxHistoryRestoration());
  // Test with the header present.
  $this->request->headers
    ->set('HX-History-Restore-Request', 'true');
  $this->assertTrue($this->isHtmxHistoryRestoration());
}

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