Example #1
0
 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');
 }
Example #2
0
 /**
  * Creates an instance of an entity.
  *
  * @param \Kreta\Component\Project\Model\Interfaces\ProjectInterface $project The project
  * @param \Kreta\Component\User\Model\Interfaces\UserInterface       $user    The user
  * @param string                                                     $role    The role assigned to the participant
  *
  * @return \Kreta\Component\Project\Model\Interfaces\ParticipantInterface
  */
 public function create(ProjectInterface $project, UserInterface $user, $role = 'ROLE_PARTICIPANT')
 {
     $participant = new $this->className($project, $user);
     $participant->setRole($role);
     $project->addParticipant($participant);
     return $participant;
 }
Example #3
0
 function it_returns_true_because_the_transition_is_in_use_by_any_issue(WorkflowInterface $workflow, StatusInterface $status, ProjectInterface $project, IssueInterface $issue, StatusInterface $status)
 {
     $this->setWorkflow($workflow)->shouldReturn($this);
     $this->getWorkflow()->shouldReturn($workflow);
     $workflow->getProjects()->shouldBeCalled()->willReturn([$project]);
     $project->getIssues()->shouldBeCalled()->willReturn([$issue]);
     $issue->getStatus()->shouldBeCalled()->willReturn($status);
     $status->getId()->shouldBeCalled()->willReturn(null);
     $this->getId()->shouldReturn(null);
     $this->isInUse()->shouldReturn(true);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function generateNumericId()
 {
     if (!$this->numericId) {
         $this->numericId = count($this->project->getIssues()) + 1;
     }
 }
Example #5
0
 function it_votes(TokenInterface $token, UserInterface $user, ProjectInterface $project)
 {
     $token->getUser()->shouldBeCalled()->willReturn($user);
     $project->getUserRole($user)->shouldBeCalled()->willReturn('ROLE_PARTICIPANT');
     $this->vote($token, $project, ['view'])->shouldReturn(1);
 }
Example #6
0
 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');
 }