WebformRestFieldsTest.php in Webform REST 4.x
File
tests/src/Functional/WebformRestFieldsTest.php
View source
<?php
namespace Drupal\Tests\webform_rest\Functional;
use Drupal\Tests\webform\Functional\WebformBrowserTestBase;
class WebformRestFieldsTest extends WebformBrowserTestBase {
public static $modules = [
'webform',
'webform_rest',
'webform_rest_test',
];
protected static $testWebforms = [
'webform_rest_test',
];
public function testWebformRestGetFields() {
$this
->drupalLogin($this->rootUser);
$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"');
}
}