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'); }
/** * {@inheritdoc} */ public function setFiniteState($state) { $statuses = $this->project->getWorkflow()->getStatuses(); foreach ($statuses as $status) { if ($state === $status->getName()) { $this->status = $status; break; } } return $this; }
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'); }