public function RequiredStatesTest::testGetRequiredStates in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/tests/src/Kernel/RequiredStatesTest.php \Drupal\Tests\workflows\Kernel\RequiredStatesTest::testGetRequiredStates()
- 10 core/modules/workflows/tests/src/Kernel/RequiredStatesTest.php \Drupal\Tests\workflows\Kernel\RequiredStatesTest::testGetRequiredStates()
@covers ::getRequiredStates @covers ::__construct
File
- core/
modules/ workflows/ tests/ src/ Kernel/ RequiredStatesTest.php, line 27
Class
- RequiredStatesTest
- Tests Workflow type's required states and configuration initialization.
Namespace
Drupal\Tests\workflows\KernelCode
public function testGetRequiredStates() {
$workflow = new Workflow([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
], 'workflow');
$workflow
->save();
$this
->assertEquals([
'fresh',
'rotten',
], $workflow
->getTypePlugin()
->getRequiredStates());
// Ensure that the workflow has the default configuration.
$this
->assertTrue($workflow
->getTypePlugin()
->hasState('rotten'));
$this
->assertTrue($workflow
->getTypePlugin()
->hasState('fresh'));
$this
->assertTrue($workflow
->getTypePlugin()
->hasTransitionFromStateToState('fresh', 'rotten'));
}