Example #1
0
 public function execute(Command $command, Responder $responder)
 {
     $user = $this->userRepository->getRandomActiveUser();
     $message = $this->messageRepository->getRandomMessageForUser($user);
     $this->slackNotifier->send($message);
     $responder->userSuccessfullyPoked();
 }
Example #2
0
 function it_should_retrieve_a_random_message_for_a_random_user_and_poke_him(MessageRepository $messageRepository, UserRepository $userRepository, SlackNotifier $slackNotifier, Responder $responder)
 {
     $userRepository->getRandomActiveUser()->willReturn($user = new User('id1', 'johndoe'));
     $messageRepository->getRandomMessageForUser($user)->willReturn($message = new Message('Test message'));
     $slackNotifier->send($message)->shouldBeCalled();
     $responder->userSuccessfullyPoked()->shouldBeCalled();
     $this->execute(new Command(), $responder);
 }