/** * Constructor. * * @param string $name The name of transition * @param \Kreta\Component\Workflow\Model\Interfaces\StatusInterface[] $initialStates Array that contains * the initial states * @param \Kreta\Component\Workflow\Model\Interfaces\StatusInterface $state The status */ public function __construct($name, array $initialStates = [], StatusInterface $state = null) { $this->name = $name; $this->state = $state; $this->initialStates = (array) $initialStates; if ($state instanceof StatusInterface) { $this->workflow = $state->getWorkflow(); } }
function it_is_not_valid_state_because_the_state_is_in_initial_states_array(StatusInterface $initial, WorkflowInterface $workflow, StatusInterface $statusTo) { $initial->getWorkflow()->shouldBeCalled()->willReturn($workflow); $workflow->getId()->shouldBeCalled()->willReturn('workflow-id'); $initial->getId()->shouldBeCalled()->willReturn('status-id'); $this->addInitialState($initial); $statusTo->getId()->shouldBeCalled()->willReturn('status-id'); $this->isValidState()->shouldReturn(false); }