public function RequiredStatesTest::testDeleteRequiredStateAPI in Drupal 9
Same name and namespace in other branches
- 8 core/modules/workflows/tests/src/Kernel/RequiredStatesTest.php \Drupal\Tests\workflows\Kernel\RequiredStatesTest::testDeleteRequiredStateAPI()
- 10 core/modules/workflows/tests/src/Kernel/RequiredStatesTest.php \Drupal\Tests\workflows\Kernel\RequiredStatesTest::testDeleteRequiredStateAPI()
@covers \Drupal\workflows\Entity\Workflow::preSave
File
- core/
modules/ workflows/ tests/ src/ Kernel/ RequiredStatesTest.php, line 45
Class
- RequiredStatesTest
- Tests Workflow type's required states and configuration initialization.
Namespace
Drupal\Tests\workflows\KernelCode
public function testDeleteRequiredStateAPI() {
$workflow = new Workflow([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
], 'workflow');
$workflow
->save();
// Ensure that required states can't be deleted.
$this
->expectException(RequiredStateMissingException::class);
$this
->expectExceptionMessage("Required State Type Test' requires states with the ID 'fresh' in workflow 'test'");
$workflow
->getTypePlugin()
->deleteState('fresh');
$workflow
->save();
}