Trait EmailAssertTrait
Email and mailer assertions.
Deprecated: 3.7.0 Use Cake\TestSuite\EmailTrait instead
Location: TestSuite/EmailAssertTrait.php
Properties summary
-
$_email
protected
Method Summary
-
assertEmailAttachmentsContains() public
Asserts the email attachments contain the given filename (and optionally file info).
-
assertEmailBcc() public
Asserts email is BCC'd to only one email address (and optionally name). -
assertEmailBccContains() public
Asserts email BCC'd addresses contain given email address (and optionally name).
-
assertEmailCc() public
Asserts email is CC'd to only one email address (and optionally name). -
assertEmailCcContains() public
Asserts email CC'd addresses contain given email address (and optionally name).
-
assertEmailFrom() public
Asserts email's sender email address and optionally name. -
assertEmailHtmlMessageContains() public
Asserts HTML email content contains$needle
. -
assertEmailMessageContains() public
Asserts email content (both text and HTML) contains$needle
. -
assertEmailSubject() public
Asserts email's subject contains$expected
. -
assertEmailTextMessageContains() public
Asserts text email content contains$needle
. -
assertEmailTo() public
Asserts email is sent to only the given recipient's address (and optionally name).
-
assertEmailToContains() public
Asserts email recipients' list contains given email address (and optionally name).
-
email() public
Creates an email instance overriding its transport for testing purposes. -
getMockForMailer() public
Generates mock for given mailer class. -
send() public
Sends email using the test email instance.
Method Detail
assertEmailAttachmentsContains() public ¶
assertEmailAttachmentsContains( string $filename , array $file null , string|null $message null )
Asserts the email attachments contain the given filename (and optionally file info).
Parameters
- string $filename
- Expected attachment's filename.
- array $file optional null
- Expected attachment's file info.
- string|null $message optional null
- The failure message to define.
assertEmailBcc() public ¶
assertEmailBcc( string $email , string|null $name null , string|null $message null )
Asserts email is BCC'd to only one email address (and optionally name).
Parameters
- string $email
- BCC'd email address.
- string|null $name optional null
- BCC'd person name.
- string|null $message optional null
- The failure message to define.
assertEmailBccContains() public ¶
assertEmailBccContains( string $email , string|null $name null , string|null $message null )
Asserts email BCC'd addresses contain given email address (and optionally name).
Parameters
- string $email
- BCC'd email address.
- string|null $name optional null
- BCC'd person name.
- string|null $message optional null
- The failure message to define.
assertEmailCc() public ¶
assertEmailCc( string $email , string|null $name null , string|null $message null )
Asserts email is CC'd to only one email address (and optionally name).
Parameters
- string $email
- CC'd email address.
- string|null $name optional null
- CC'd person name.
- string|null $message optional null
- The failure message to define.
assertEmailCcContains() public ¶
assertEmailCcContains( string $email , string|null $name null , string|null $message null )
Asserts email CC'd addresses contain given email address (and optionally name).
Parameters
- string $email
- CC'd email address.
- string|null $name optional null
- CC'd person name.
- string|null $message optional null
- The failure message to define.
assertEmailFrom() public ¶
assertEmailFrom( string $email , string|null $name null , string|null $message null )
Asserts email's sender email address and optionally name.
Parameters
- string $email
- Sender's email address.
- string|null $name optional null
- Sender's name.
- string|null $message optional null
- The failure message to define.
assertEmailHtmlMessageContains() public ¶
assertEmailHtmlMessageContains( string $needle , string|null $message null )
Asserts HTML email content contains $needle
.
Parameters
- string $needle
- Text to look for.
- string|null $message optional null
- The failure message to define.
assertEmailMessageContains() public ¶
assertEmailMessageContains( string $needle , string|null $message null )
Asserts email content (both text and HTML) contains $needle
.
Parameters
- string $needle
- Text to look for.
- string|null $message optional null
- The failure message to define.
assertEmailSubject() public ¶
assertEmailSubject( string $expected , string|null $message null )
Asserts email's subject contains $expected
.
Parameters
- string $expected
- Email's subject.
- string|null $message optional null
- The failure message to define.
assertEmailTextMessageContains() public ¶
assertEmailTextMessageContains( string $needle , string|null $message null )
Asserts text email content contains $needle
.
Parameters
- string $needle
- Text to look for.
- string|null $message optional null
- The failure message to define.
assertEmailTo() public ¶
assertEmailTo( string $email , string|null $name null , string|null $message null )
Asserts email is sent to only the given recipient's address (and optionally name).
Parameters
- string $email
- Recipient's email address.
- string|null $name optional null
- Recipient's name.
- string|null $message optional null
- The failure message to define.
assertEmailToContains() public ¶
assertEmailToContains( string $email , string|null $name null , string|null $message null )
Asserts email recipients' list contains given email address (and optionally name).
Parameters
- string $email
- Recipient's email address.
- string|null $name optional null
- Recipient's name.
- string|null $message optional null
- The failure message to define.
email() public ¶
email( boolean $new false )
Creates an email instance overriding its transport for testing purposes.
Parameters
- boolean $new optional false
- Tells if new instance should forcibly be created.
Returns
getMockForMailer() public ¶
getMockForMailer( string $className , array $methods [] )
Generates mock for given mailer class.
Parameters
- string $className
- The mailer's FQCN.
- array $methods optional []
- The methods to mock on the mailer.
Returns
Cake\Mailer\Mailer
|PHPUnit_Framework_MockObject_MockObjectMagic methods summary
any() public ¶
any( )
Returns
assertSame() public ¶
assertSame( $expected , $result , $message )
Parameters
- $expected
- $result
- $message
assertTextContains() public ¶
assertTextContains( $needle , $haystack , $message )
Parameters
- $needle
- $haystack
- $message
getMockBuilder() public ¶
getMockBuilder( $className )
Parameters
- $className