本文整理汇总了PHP中Swift_Message::getContentType方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Message::getContentType方法的具体用法?PHP Swift_Message::getContentType怎么用?PHP Swift_Message::getContentType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::getContentType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createMessage
/**
* @param Swift_Message $message
*
* @return Swift_Message
*/
protected function createMessage(Swift_Message $message)
{
$mimeEntity = new Swift_Message('', $message->getBody(), $message->getContentType(), $message->getCharset());
$mimeEntity->setChildren($message->getChildren());
$messageHeaders = $mimeEntity->getHeaders();
$messageHeaders->remove('Message-ID');
$messageHeaders->remove('Date');
$messageHeaders->remove('Subject');
$messageHeaders->remove('MIME-Version');
$messageHeaders->remove('To');
$messageHeaders->remove('From');
return $mimeEntity;
}
示例2: getContentType
/**
* {@inheritdoc}
*/
public function getContentType()
{
return $this->message->getContentType();
}
示例3: testMimeTypeIsMixed
/**
* The multipart/mixed content-type is more significant than multipart/related.
*/
public function testMimeTypeIsMixed()
{
$msg = new Swift_Message();
$msg->attach(new Swift_Message_Part("foo"));
$this->assertEqual("multipart/alternative", $msg->getContentType());
$msg->attach(new Swift_Message_EmbeddedFile("bar"));
$this->assertEqual("multipart/related", $msg->getContentType());
$msg->attach(new Swift_Message_Attachment("zip"));
$this->assertEqual("multipart/mixed", $msg->getContentType());
$msg->attach(new Swift_Message_EmbeddedFile("button"));
$this->assertEqual("multipart/mixed", $msg->getContentType());
}
示例4: assertSendCalled
/**
* @param string $templateName
* @param array $templateParams
* @param \Swift_Message $expectedMessage
* @param string $emailType
*/
protected function assertSendCalled($templateName, array $templateParams, \Swift_Message $expectedMessage, $emailType = 'txt')
{
$this->emailTemplate->expects($this->once())->method('getType')->willReturn($emailType);
$this->objectRepository->expects($this->once())->method('findOneBy')->with(['name' => $templateName])->willReturn($this->emailTemplate);
$this->renderer->expects($this->once())->method('compileMessage')->with($this->emailTemplate, $templateParams)->willReturn([$expectedMessage->getSubject(), $expectedMessage->getBody()]);
$to = $expectedMessage->getTo();
$toKeys = array_keys($to);
$this->emailHolderHelper->expects($this->once())->method('getEmail')->with($this->isInstanceOf('Oro\\Bundle\\UserBundle\\Entity\\UserInterface'))->willReturn(array_shift($toKeys));
$this->mailer->expects($this->once())->method('send')->with($this->callback(function (\Swift_Message $actualMessage) use($expectedMessage) {
$this->assertEquals($expectedMessage->getSubject(), $actualMessage->getSubject());
$this->assertEquals($expectedMessage->getFrom(), $actualMessage->getFrom());
$this->assertEquals($expectedMessage->getTo(), $actualMessage->getTo());
$this->assertEquals($expectedMessage->getBody(), $actualMessage->getBody());
$this->assertEquals($expectedMessage->getContentType(), $actualMessage->getContentType());
return true;
}));
}