function it_does_not_vote_view_grant(TokenInterface $token, Project $project, UserInterface $user, Workflow $workflow) { $token->getUser()->shouldBeCalled()->willReturn($user); $workflow->getProjects()->shouldBeCalled()->willReturn([$project]); $project->getUserRole($user)->shouldBeCalled()->willReturn(null); $this->vote($token, $workflow, ['view'])->shouldReturn(-1); }
function it_votes_add_participant_delete_delete_participant_or_edit_because_its_role_project_is_admin(TokenInterface $token, UserInterface $user, Project $project) { $token->getUser()->shouldBeCalled()->willReturn($user); $project->getUserRole($user)->shouldBeCalled()->willReturn('ROLE_ADMIN'); $this->vote($token, $project, ['add_participant'])->shouldReturn(1); }
function it_is_participant(UserInterface $anotherUser) { $project = new Project(); $user = new User(); $participant = new Participant($project, $user); $project->addParticipant($participant); $this->setProject($project)->shouldReturn($this); $this->isParticipant($anotherUser)->shouldReturn(true); }