function StateTest::testGetTransitionToException
@covers ::getTransitionTo
      
    
File
- 
              core/
modules/ workflows/ tests/ src/ Unit/ StateTest.php, line 71  
Class
- StateTest
 - @coversDefaultClass \Drupal\workflows\State[[api-linebreak]]
 
Namespace
Drupal\Tests\workflows\UnitCode
public function testGetTransitionToException() : void {
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessage("Can not transition to 'published' state");
  $workflow_type = new TestType([], '', []);
  $workflow_type->addState('draft', 'Draft');
  $state = $workflow_type->getState('draft');
  $state->getTransitionTo('published');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.