function testSender() { $factory = new Factory('key'); $message = $factory->convertRequestToMessage(new Request('POST', '/', [], http_build_query(json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'message-sender.json'), true)))); $this->assertEquals('*****@*****.**', $message->getFromEmail()); $this->assertEquals('Nikolka -', $message->getFromName()); }
function testPlainMessage() { $factory = new Factory('key'); $message = $factory->convertRequestToMessage(new Request('POST', '/', [], http_build_query(json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'message-plain.json'), true)))); $this->assertEquals('', $message->getBodyHtml()); $this->assertEquals('Dobry den, zdravime za test.cz.', $message->getBodyPlain()); $this->assertEquals(new \DateTime('2016-05-04T16:08:13+0200'), $message->getDate()); $this->assertEquals([], $message->getAttachments()); $this->assertEquals('*****@*****.**', $message->getFromEmail()); $this->assertEquals('Adam Novak', $message->getFromName()); $this->assertEquals('<*****@*****.**>', $message->getId()); $this->assertEquals('', $message->getReferences()); $this->assertEquals('', $message->getReplyTo()); $this->assertEquals(0, $message->getSpamScore()); $this->assertEquals('', $message->getStrippedHtml()); $this->assertEquals('Feed s produkty', $message->getSubject()); $this->assertEquals('', $message->getThreadIndex()); $this->assertEquals('*****@*****.**', $message->getToEmail()); $this->assertEquals('', $message->getToName()); }