public function TransitionTest::testFromAndTo in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workflows/tests/src/Unit/TransitionTest.php \Drupal\Tests\workflows\Unit\TransitionTest::testFromAndTo()
- 10 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 38
Class
- TransitionTest
- @coversDefaultClass \Drupal\workflows\Transition
Namespace
Drupal\Tests\workflows\UnitCode
public function testFromAndTo() {
$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());
}