public function WorkflowUiTest::testStateMachineNameValidation in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/tests/src/Functional/WorkflowUiTest.php \Drupal\Tests\workflows\Functional\WorkflowUiTest::testStateMachineNameValidation()
Test the machine name validation of the state add form.
File
- core/
modules/ workflows/ tests/ src/ Functional/ WorkflowUiTest.php, line 91
Class
- WorkflowUiTest
- Tests workflow creation UI.
Namespace
Drupal\Tests\workflows\FunctionalCode
public function testStateMachineNameValidation() {
Workflow::create([
'id' => 'test_workflow',
'type' => 'workflow_type_test',
])
->save();
$this
->drupalLogin($this
->createUser([
'administer workflows',
]));
$this
->drupalPostForm('admin/config/workflow/workflows/manage/test_workflow/add_state', [
'label' => 'Test State',
'id' => 'Invalid ID',
], 'Save');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('The machine-readable name must contain only lowercase letters, numbers, and underscores.');
$this
->drupalPostForm('admin/config/workflow/workflows/manage/test_workflow/add_transition', [
'label' => 'Test Transition',
'id' => 'Invalid ID',
], 'Save');
$this
->assertSession()
->pageTextContains('The machine-readable name must contain only lowercase letters, numbers, and underscores.');
}