function TransitionTest::testFromAndTo
Same name in other branches
- 9 core/modules/workflows/tests/src/Unit/TransitionTest.php \Drupal\Tests\workflows\Unit\TransitionTest::testFromAndTo()
- 8.9.x core/modules/workflows/tests/src/Unit/TransitionTest.php \Drupal\Tests\workflows\Unit\TransitionTest::testFromAndTo()
- 11.x core/modules/workflows/tests/src/Unit/TransitionTest.php \Drupal\Tests\workflows\Unit\TransitionTest::testFromAndTo()
@covers ::from @covers ::to
File
-
core/
modules/ workflows/ tests/ src/ Unit/ TransitionTest.php, line 40
Class
- TransitionTest
- @coversDefaultClass \Drupal\workflows\Transition
Namespace
Drupal\Tests\workflows\UnitCode
public function testFromAndTo() : void {
$workflow = new TestType([], '', []);
$workflow->addState('draft', 'Draft')
->addState('published', 'Published')
->addTransition('publish', 'Publish', [
'draft',
], 'published');
$state = $workflow->getState('draft');
$transition = $state->getTransitionTo('published');
$this->assertEquals($state, $transition->from()['draft']);
$this->assertEquals($workflow->getState('published'), $transition->to());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.