You are here

public function WebformRestElementsTest::testWebformRestGetElements in Webform REST 8.2

Same name and namespace in other branches
  1. 4.x tests/src/Functional/WebformRestElementsTest.php \Drupal\Tests\webform_rest\Functional\WebformRestElementsTest::testWebformRestGetElements()

Test method GET elements resource.

File

tests/src/Functional/WebformRestElementsTest.php, line 35

Class

WebformRestElementsTest
Test the webform rest endpoints for elements.

Namespace

Drupal\Tests\webform_rest\Functional

Code

public function testWebformRestGetElements() {
  $this
    ->drupalLogin($this->rootUser);

  // Get webform elements.
  $result = $this
    ->drupalGet("/webform_rest/webform_rest_test/elements", [
    'query' => [
      '_format' => 'hal_json',
    ],
  ]);
  $this
    ->assertResponse(200);
  $this
    ->assertRaw('"first_name":{"#title":"First name"');
  $this
    ->assertRaw('"last_name":{"#title":"Last name"');
}