public function WebformTokenValidateTest::testWebformTokenValidate in Webform 8.5
Same name and namespace in other branches
- 6.x tests/src/Functional/Token/WebformTokenValidateTest.php \Drupal\Tests\webform\Functional\Token\WebformTokenValidateTest::testWebformTokenValidate()
Test webform token element validation.
File
- tests/
src/ Functional/ Token/ WebformTokenValidateTest.php, line 24
Class
- WebformTokenValidateTest
- Tests for webform token element validation.
Namespace
Drupal\Tests\webform\Functional\TokenCode
public function testWebformTokenValidate() {
$this
->drupalLogin($this->rootUser);
// Check invalid token validation.
$this
->drupalPostForm('/admin/structure/webform/config', [
'form_settings[default_form_open_message][value]' => '[webform:invalid]',
], 'Save configuration');
$this
->assertRaw('invalid tokens');
$this
->assertRaw('<em class="placeholder">Default open message</em> is using the following invalid tokens: [webform:invalid].');
// Check valid token validation.
$this
->drupalPostForm('/admin/structure/webform/config', [
'form_settings[default_form_open_message][value]' => '[webform:title]',
], 'Save configuration');
$this
->assertNoRaw('invalid tokens');
}