function HtmxAttributesTest::testHxPut

Test put method.

File

core/tests/Drupal/Tests/Core/Htmx/HtmxAttributesTest.php, line 90

Class

HtmxAttributesTest
Test all attribute-related Htmx public methods.

Namespace

Drupal\Tests\Core\Htmx

Code

public function testHxPut() : void {
  $this->htmx
    ->put($this->url);
  $render = $this->apply();
  // The paths in GitLabCI include a subfolder.
  $this->assertTrue(isset($render['#attributes']['data-hx-put']));
  $this->assertStringEndsWith('/common-test/destination', $render['#attributes']['data-hx-put']);
  // Verify no parameters.
  $this->htmx
    ->put();
  $render = $this->apply();
  $this->assertTrue(isset($render['#attributes']['data-hx-put']));
  $this->assertEquals('', $render['#attributes']['data-hx-put']);
}

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