Example #1
0
 public function testShouldAddRecipientVariables()
 {
     $that = $this;
     $this->mailgun->sendMessage('www.example.org', Argument::type('array'), Argument::cetera())->shouldBeCalled()->will(function ($args) use($that) {
         $postData = $args[1];
         $that->assertArrayHasKey('recipient-variables', $postData);
         $that->assertJson($postData['recipient-variables']);
         $resp = new \stdClass();
         $resp->http_response_code = 200;
         return $resp;
     });
     $this->handler->notify(Email::create()->addVariablesForRecipient('*****@*****.**', ['key' => 'value'])->addTo('*****@*****.**'));
 }
 public function testShouldSkipNotSupportedHandlers()
 {
     $notification = Email::create();
     $handler = $this->prophesize(NotificationHandlerInterface::class);
     $handler->getName()->willReturn('swiftmailer');
     $handler->supports(Argument::any())->willReturn(false);
     $handler->notify(Argument::any())->shouldNotBeCalled();
     $handler2 = $this->prophesize(NotificationHandlerInterface::class);
     $handler2->getName()->willReturn('default');
     $handler2->supports(Argument::any())->willReturn(true);
     $handler2->notify(Argument::any())->shouldBeCalled();
     $this->manager->addHandler($handler->reveal());
     $this->manager->addHandler($handler2->reveal());
     $this->manager->notify($notification);
 }
Example #3
0
 /**
  * @expectedException \Fazland\Notifire\Exception\PartContentTypeMismatchException
  */
 public function testAddPartShouldThrowIfTwoPartsWithSameContentTypeHasAdded()
 {
     Email::create()->addPart(Email\Part::create('BlaBla', 'text/html'))->addPart(Email\Part::create('Foo bar', 'text/html'));
 }