public function it_ignores_the_event_if_the_clients_payment_method_is_not_mail(Mailer $mailer, Client $client, ClientBilledEvent $event) { $event->getClient()->willReturn($client); $client->getPaymentMethod()->shouldBeCalled()->willReturn('other'); $mailer->notifyClient($client)->shouldNotBeCalled(); $this->onClientBilled($event); }
/** * @param ClientBilledEvent $event */ public function onClientBilled(ClientBilledEvent $event) { $client = $event->getClient(); if ($client->getPaymentMethod() != Client::PAYMENT_MAIL) { return; } $this->mailer->notifyClient($client); }