function HtmxAttributesTest::testHxPatch
Test patch method.
File
-
core/
tests/ Drupal/ Tests/ Core/ Htmx/ HtmxAttributesTest.php, line 106
Class
- HtmxAttributesTest
- Test all attribute-related Htmx public methods.
Namespace
Drupal\Tests\Core\HtmxCode
public function testHxPatch() : void {
$this->htmx
->patch($this->url);
$render = $this->apply();
// The paths in GitLabCI include a subfolder.
$this->assertTrue(isset($render['#attributes']['data-hx-patch']));
$this->assertStringEndsWith('/common-test/destination', $render['#attributes']['data-hx-patch']);
// Verify no parameters.
$this->htmx
->patch();
$render = $this->apply();
$this->assertTrue(isset($render['#attributes']['data-hx-patch']));
$this->assertEquals('', $render['#attributes']['data-hx-patch']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.