function it_creates_a_issue(ProjectInterface $project, WorkflowInterface $workflow, StatusInterface $status, UserInterface $user, IssuePriorityInterface $issuePriority, IssueInterface $parent) { $project->getWorkflow()->shouldBeCalled()->willReturn($workflow); $workflow->getStatuses()->shouldBeCalled()->willReturn([$status]); $status->getType()->shouldBeCalled()->willReturn('initial'); $this->create($user, $issuePriority, $project, $parent)->shouldReturnAnInstanceOf('Kreta\\Component\\Issue\\Model\\Issue'); }
function it_loads(IssueInterface $issue, StatusInterface $status, StatusInterface $status2, StatusTransitionInterface $transition) { $status->getName()->shouldBeCalled()->willReturn('Open'); $status->getType()->shouldBeCalled()->willReturn('initial'); $status2->getName()->shouldBeCalled()->willReturn('In progress'); $status2->getType()->shouldBeCalled()->willReturn('normal'); $transition->getInitialStates()->shouldBeCalled()->willReturn([$status]); $transition->getName()->shouldBeCalled()->willReturn('Start progress'); $transition->getState()->shouldBeCalled()->willReturn($status2); $this->load($issue, [$status, $status2], [$transition])->shouldReturnAnInstanceOf('Kreta\\Component\\Issue\\StateMachine\\IssueStateMachine'); }
/** * Method which validates if the state is also an initial state. * It is a validation method with its assertions. * * @return boolean */ public function isValidState() { if ($this->state instanceof StatusInterface) { foreach ($this->initialStates as $initialState) { if ($initialState->getId() === $this->state->getId()) { return false; } } } return true; }
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); }
/** * {@inheritdoc} */ public function getFiniteState() { return $this->status->getName(); }
function its_finite_state_is_mutable(ProjectInterface $project, WorkflowInterface $workflow, StatusInterface $status) { $status->getName()->shouldBeCalled()->willReturn('Done'); $project->getWorkflow()->shouldBeCalled()->willReturn($workflow); $workflow->getStatuses()->shouldBeCalled()->willReturn([$status]); $this->setProject($project); $this->setFiniteState('Done')->shouldReturn($this); $this->getFiniteState()->shouldReturn('Done'); }