Example #1
0
 function it_gets_notifications(IssueInterface $issue, UserInterface $assignee, UserInterface $reporter, ProjectInterface $project, RouterInterface $router, NotificationFactory $factory, NotificationInterface $notification)
 {
     $issue->getAssignee()->shouldBeCalled()->willReturn($assignee);
     $issue->getReporter()->shouldBeCalled()->willReturn($reporter);
     $issue->getProject()->shouldBeCalled()->willReturn($project);
     $issue->getId()->shouldBeCalled()->willReturn('issue-id');
     $router->generate('get_issue', ['issueId' => 'issue-id'])->shouldBeCalled()->willReturn('http://kreta.io');
     $factory->create()->shouldBeCalled()->willReturn($notification);
     $issue->getProject()->shouldBeCalled()->willReturn($project);
     $notification->setProject($project)->shouldBeCalled()->willReturn($notification);
     $issue->getTitle()->shouldBeCalled()->willReturn('Issue title');
     $notification->setTitle('Issue title')->shouldBeCalled()->willReturn($notification);
     $issue->getDescription()->shouldBeCalled()->willReturn('The issue description');
     $notification->setDescription('The issue description')->shouldBeCalled()->willReturn($notification);
     $notification->setType('issue_new')->shouldBeCalled()->willReturn($notification);
     $notification->setResourceUrl('http://kreta.io')->shouldBeCalled()->willReturn($notification);
     $notification->setWebUrl('http://kreta.io')->shouldBeCalled()->willReturn($notification);
     $issue->getAssignee()->shouldBeCalled()->willReturn($assignee);
     $notification->setUser($assignee)->shouldBeCalled()->willReturn($notification);
     $this->getNotifications('postPersist', $issue)->shouldReturn([$notification]);
 }