function RequiredStatesTest::testGetRequiredStates
Same name in other branches
- 9 core/modules/workflows/tests/src/Kernel/RequiredStatesTest.php \Drupal\Tests\workflows\Kernel\RequiredStatesTest::testGetRequiredStates()
- 8.9.x 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 29
Class
- RequiredStatesTest
- Tests Workflow type's required states and configuration initialization.
Namespace
Drupal\Tests\workflows\KernelCode
public function testGetRequiredStates() : void {
$workflow = Workflow::create([
'id' => 'test',
'label' => 'Test workflow',
'type' => 'workflow_type_required_state_test',
]);
$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'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.