function WorkflowTest::testAddStateException
Tests add state exception.
@legacy-covers ::addState
File
-
core/
modules/ workflows/ tests/ src/ Unit/ WorkflowTest.php, line 69
Class
Namespace
Drupal\Tests\workflows\UnitCode
public function testAddStateException() : void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("The state 'draft' already exists in workflow.");
$workflow = new Workflow([
'id' => 'test',
'type' => 'test_type',
], 'workflow');
$workflow->getTypePlugin()
->addState('draft', 'Draft');
$workflow->getTypePlugin()
->addState('draft', 'Draft');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.