You are here

public function WebformRestFieldsTest::testWebformRestGetFields in Webform REST 4.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/WebformRestFieldsTest.php \Drupal\Tests\webform_rest\Functional\WebformRestFieldsTest::testWebformRestGetFields()

Test method GET fields resource.

File

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

Class

WebformRestFieldsTest
Test the webform rest endpoints for fields.

Namespace

Drupal\Tests\webform_rest\Functional

Code

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

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