CakePHP
  • 文档
    • 书籍
    • API
    • 视频
    • 报告安全问题
    • 隐私政策
    • 徽标和商标
  • 商业解决方案
  • 礼品
  • 公路旅行
  • 团队
  • 社区
    • 社区
    • 参与
    • 问题 (Github)
    • 烘焙坊
    • 特色资源
    • 培训
    • 聚会
    • 我的 CakePHP
    • CakeFest
    • 时事通讯
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • 帮助和支持
    • 论坛
    • Stack Overflow
    • IRC
    • Slack
    • 付费支持
CakePHP

C CakePHP 5.1 Chiffon API

  • 项目
    • CakePHP
      • CakePHP
      • Chronos
      • Elastic Search
      • 队列
  • 版本
    • 5.1
      • 5.1
      • 5.0
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

命名空间

  • 全局
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
      • Constraint
      • Fixture
      • Stub
    • Utility
    • Validation
    • View

Trait EmailTrait

对通过 Cake\TestSuite\TestEmailTransport 发送的电子邮件进行断言

在将特征添加到您的测试用例后,所有邮件传输将被替换为 TestEmailTransport,该传输用于进行断言,并且 *不会* 实际发送邮件。

命名空间: Cake\TestSuite

方法摘要

  • assertMailContains() public

    断言电子邮件包含预期内容

  • assertMailContainsAt() public

    断言特定索引处的电子邮件包含预期内容

  • assertMailContainsAttachment() public

    断言电子邮件包含预期附件

  • assertMailContainsHtml() public

    断言电子邮件包含预期的 html 内容

  • assertMailContainsHtmlAt() public

    断言特定索引处的电子邮件包含预期的 html 内容

  • assertMailContainsText() public

    断言电子邮件包含预期的文本内容

  • assertMailContainsTextAt() public

    断言特定索引处的电子邮件包含预期的文本内容

  • assertMailCount() public

    断言发送了预期数量的电子邮件

  • assertMailSentFrom() public

    断言从地址发送了电子邮件

  • assertMailSentFromAt() public

    断言特定索引处的电子邮件从地址发送

  • assertMailSentTo() public

    断言电子邮件发送到地址

  • assertMailSentToAt() public

    断言特定索引处的电子邮件发送到地址

  • assertMailSentWith() public

    断言电子邮件在电子邮件 getter 中包含预期值

  • assertMailSentWithAt() public

    断言特定索引处的电子邮件在电子邮件 getter 中包含预期值

  • assertMailSubjectContains() public

    断言电子邮件主题包含预期内容

  • assertMailSubjectContainsAt() public

    断言特定索引处的电子邮件包含预期的 html 内容

  • assertNoMailSent() public

    断言没有发送电子邮件

  • cleanupEmailTrait() public

    重置传输状态

  • setupTransports() public

    在测试设置期间用测试传输替换所有传输

方法详细

assertMailContains() ¶ public

assertMailContains(string $contents, string $message = ''): void

断言电子邮件包含预期内容

参数
string $contents

内容

string $message optional

信息

返回
void

assertMailContainsAt() ¶ public

assertMailContainsAt(int $at, string $contents, string $message = ''): void

断言特定索引处的电子邮件包含预期内容

参数
int $at

电子邮件索引

string $contents

内容

string $message optional

信息

返回
void

assertMailContainsAttachment() ¶ public

assertMailContainsAttachment(string $filename, array $file = [], string $message = ''): void

断言电子邮件包含预期附件

参数
string $filename

文件名

array $file optional

附加文件属性

string $message optional

信息

返回
void

assertMailContainsHtml() ¶ public

assertMailContainsHtml(string $contents, string $message = ''): void

断言电子邮件包含预期的 html 内容

参数
string $contents

内容

string $message optional

信息

返回
void

assertMailContainsHtmlAt() ¶ public

assertMailContainsHtmlAt(int $at, string $contents, string $message = ''): void

断言特定索引处的电子邮件包含预期的 html 内容

参数
int $at

电子邮件索引

string $contents

内容

string $message optional

信息

返回
void

assertMailContainsText() ¶ public

assertMailContainsText(string $expected, string $message = ''): void

断言电子邮件包含预期的文本内容

参数
string $expected

预期文本。

string $message optional

断言失败时要显示的消息。

返回
void

assertMailContainsTextAt() ¶ public

assertMailContainsTextAt(int $at, string $contents, string $message = ''): void

断言特定索引处的电子邮件包含预期的文本内容

参数
int $at

电子邮件索引

string $contents

内容

string $message optional

信息

返回
void

assertMailCount() ¶ public

assertMailCount(int $count, string $message = ''): void

断言发送了预期数量的电子邮件

参数
int $count

电子邮件数量

string $message optional

信息

返回
void

assertMailSentFrom() ¶ public

assertMailSentFrom(list<string>|string $address, string $message = ''): void

断言从地址发送了电子邮件

参数
list<string>|string $address

电子邮件地址

string $message optional

信息

返回
void

assertMailSentFromAt() ¶ public

assertMailSentFromAt(int $at, string $address, string $message = ''): void

断言特定索引处的电子邮件从地址发送

参数
int $at

电子邮件索引

string $address

电子邮件地址

string $message optional

信息

返回
void

assertMailSentTo() ¶ public

assertMailSentTo(string $address, string $message = ''): void

断言电子邮件发送到地址

参数
string $address

电子邮件地址

string $message optional

信息

返回
void

assertMailSentToAt() ¶ public

assertMailSentToAt(int $at, string $address, string $message = ''): void

断言特定索引处的电子邮件发送到地址

参数
int $at

电子邮件索引

string $address

电子邮件地址

string $message optional

信息

返回
void

assertMailSentWith() ¶ public

assertMailSentWith(string $expected, string $parameter, string $message = ''): void

断言电子邮件在电子邮件 getter 中包含预期值

参数
string $expected

内容

string $parameter

电子邮件 getter 参数(例如“cc”、“subject”)

string $message optional

信息

返回
void

assertMailSentWithAt() ¶ public

assertMailSentWithAt(int $at, string $expected, string $parameter, string $message = ''): void

断言特定索引处的电子邮件在电子邮件 getter 中包含预期值

参数
int $at

电子邮件索引

string $expected

内容

string $parameter

电子邮件 getter 参数(例如“cc”、“bcc”)

string $message optional

信息

返回
void

assertMailSubjectContains() ¶ public

assertMailSubjectContains(string $contents, string $message = ''): void

断言电子邮件主题包含预期内容

参数
string $contents

内容

string $message optional

信息

返回
void

assertMailSubjectContainsAt() ¶ public

assertMailSubjectContainsAt(int $at, string $contents, string $message = ''): void

断言特定索引处的电子邮件包含预期的 html 内容

参数
int $at

电子邮件索引

string $contents

内容

string $message optional

信息

返回
void

assertNoMailSent() ¶ public

assertNoMailSent(string $message = ''): void

断言没有发送电子邮件

参数
string $message optional

信息

返回
void

cleanupEmailTrait() ¶ public

cleanupEmailTrait(): void

重置传输状态

返回
void

setupTransports() ¶ public

setupTransports(): void

在测试设置期间用测试传输替换所有传输

返回
void
OpenHub
Pingping
Linode
  • 商业解决方案
  • 展示
  • 文档
  • 书籍
  • API
  • 视频
  • 报告安全问题
  • 隐私政策
  • 徽标和商标
  • 社区
  • 参与
  • 问题 (Github)
  • 烘焙坊
  • 特色资源
  • 培训
  • 聚会
  • 我的 CakePHP
  • CakeFest
  • 时事通讯
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • 帮助和支持
  • 论坛
  • Stack Overflow
  • IRC
  • Slack
  • 付费支持

使用 CakePHP API 文档 生成