W3cubDocs

/CakePHP 3.8

Trait EmailAssertTrait

Email and mailer assertions.

Namespace: Cake\TestSuite
Deprecated: 3.7.0 Use Cake\TestSuite\EmailTrait instead
Location: TestSuite/EmailAssertTrait.php

Properties summary

Method Summary

  • Asserts the email attachments contain the given filename (and optionally file info).

  • assertEmailBcc() public deprecated
    Asserts email is BCC'd to only one email address (and optionally name).
  • assertEmailBccContains() public deprecated

    Asserts email BCC'd addresses contain given email address (and optionally name).

  • assertEmailCc() public deprecated
    Asserts email is CC'd to only one email address (and optionally name).
  • assertEmailCcContains() public deprecated

    Asserts email CC'd addresses contain given email address (and optionally name).

  • assertEmailFrom() public deprecated
    Asserts email's sender email address and optionally name.
  • Asserts HTML email content contains $needle.
  • assertEmailMessageContains() public deprecated
    Asserts email content (both text and HTML) contains $needle.
  • assertEmailSubject() public deprecated
    Asserts email's subject contains $expected.
  • Asserts text email content contains $needle.
  • assertEmailTo() public deprecated

    Asserts email is sent to only the given recipient's address (and optionally name).

  • assertEmailToContains() public deprecated

    Asserts email recipients' list contains given email address (and optionally name).

  • email() public deprecated
    Creates an email instance overriding its transport for testing purposes.
  • getMockForMailer() public deprecated
    Generates mock for given mailer class.
  • send() public deprecated
    Sends email using the test email instance.

Method Detail

assertEmailAttachmentsContains()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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()source public deprecated

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

Cake\Mailer\Email

getMockForMailer()source public deprecated

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_MockObject

send()source public deprecated

send( array|string|null $content = null )

Sends email using the test email instance.

Parameters

array|string|null $content optional null
The email's content to send.

Magic methods summary

any()source public deprecated

any( )

Returns

PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount

assertSame()source public deprecated

assertSame( $expected , $result , $message )

Parameters

$expected
$result
$message

assertTextContains()source public deprecated

assertTextContains( $needle , $haystack , $message )

Parameters

$needle
$haystack
$message

getMockBuilder()source public deprecated

getMockBuilder( $className )

Parameters

$className

Returns

PHPUnit_Framework_MockObject_MockBuilder

Properties detail

$_emailsource

protected Cake\Mailer\Email

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.TestSuite.EmailAssertTrait.html