当前位置: 首页>>代码示例>>PHP>>正文


PHP Notifier::createSendWithAttachments方法代码示例

本文整理汇总了PHP中Notifier::createSendWithAttachments方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::createSendWithAttachments方法的具体用法?PHP Notifier::createSendWithAttachments怎么用?PHP Notifier::createSendWithAttachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notifier的用法示例。


在下文中一共展示了Notifier::createSendWithAttachments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSendWithAttachments

 public function testSendWithAttachments()
 {
     $n = new Notifier();
     $result = $n->createSendWithAttachments();
     $attachments = $n->getAttachments();
     $attachment = current($attachments);
     $this->assertEquals('text/plain', $attachment['contentType']);
     $this->assertEquals('the attachment', $attachment['body']);
     $this->assertEquals('check_it_out.txt', $attachment['filename']);
     $this->assertEquals('base64', $attachment['transferEncoding']);
     // result has both headers/body
     $this->assertContains('Dear Derek,', $result);
     $this->assertEquals('derek@maintainable.com', $n->getRecipients());
     $this->assertEquals('Confirmation for test', $n->getSubject());
     // headers
     $this->assertContains('Date:', $n->getHeaders());
     $this->assertContains('From: test@example.com', $n->getHeaders());
     $this->assertContains('Mime-Version: 1.0', $n->getHeaders());
     // body
     $this->assertContains('Content-Type: text/plain; charset="utf-8"', $n->getBody());
     $this->assertContains('Dear Derek,', $n->getBody());
     $this->assertContains('The Maintainable Team', $n->getBody());
     // attachments
     $this->assertContains('Content-Transfer-Encoding: base64', $n->getBody());
     $this->assertContains('Content-Disposition: attachment; filename="check_it_out.txt"', $n->getBody());
 }
开发者ID:lerre,项目名称:framework,代码行数:26,代码来源:BaseTest.php


注:本文中的Notifier::createSendWithAttachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。