$workflow =
new Workflow(['id' => 'test', 'type' => 'test_type'
], 'workflow'
);
$workflow->
getTypePlugin()->
getState('state_that_does_not_exist'
);
} /**
* @covers ::setStateLabel
*/
public function testSetStateLabel() { $workflow =
new Workflow(['id' => 'test', 'type' => 'test_type'
], 'workflow'
);
$workflow->
getTypePlugin()->
addState('draft', 'Draft'
);
$this->
assertEquals('Draft',
$workflow->
getTypePlugin()->
getState('draft'
)->
label());
$workflow->
getTypePlugin()->
setStateLabel('draft', 'Unpublished'
);
$this->
assertEquals('Unpublished',
$workflow->
getTypePlugin()->
getState('draft'
)->
label());
} /**
* @covers ::setStateLabel
*/
public function testSetStateLabelException() { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage("The state 'draft' does not exist in workflow."
);
$workflow =
new Workflow(['id' => 'test', 'type' => 'test_type'
], 'workflow'
);
$workflow->
getTypePlugin()->
setStateLabel('draft', 'Draft'
);
}