Constants

USE_EXCEPTIONS

USE_EXCEPTIONS = null : bool|null

Whether or not to initialize the PHPMailer object to throw exceptions.

Overload this constant in a concrete test class and set the value to true to initialize PHPMailer with Exceptions turned on.

Properties

$propertyChanges

$propertyChanges : array

Property names and their values for the test instance of the PHPMailer class.

These (public) properties will be set in the set_up() method.

This property can be enhanced/overloaded in concrete test classes to change the presets or add additional properties.

It is the responsibility of the individual test classes to ensure that property values of the correct type are passed.

Type

array — Key is the property name, value the desired value for the PHPMailer instance.

$Mail

$Mail : \PHPMailer\PHPMailer\PHPMailer

Holds the PHPMailer instance.

Type

PHPMailer

$ChangeLog

$ChangeLog : string[]

Holds the change log.

Type

string[]

$NoteLog

$NoteLog : string[]

Holds the note log.

Type

string[]

$changelogExclude

$changelogExclude

$PHPMailerStaticProps

$PHPMailerStaticProps : array

List of *static* properties in the PHPMailer class which _may_ be changed from within a test, with their default values.

This list is used by the {@see TestCase::resetStaticProperties()} method, as well as in the {@see TestCase::checkChanges()} method.

Type

array — Key is the property name, value the default as per the PHPMailer class.

Methods

set_up_before_class()

set_up_before_class() : mixed

Run before each test class.

Returns

mixed —

updateStaticProperty()

updateStaticProperty(string  $className, string  $propertyName, mixed  $value) : mixed

Update the value of a - potentially inaccessible - static property in a class.

Parameters

string $className

The target class.

string $propertyName

The name of the static property.

mixed $value

The new value for the property.

Returns

mixed —

testAddEmbeddedImage()

testAddEmbeddedImage() : mixed

Test successfully adding an embedded image.

Returns

mixed —

testAddingImageWithoutExplicitName()

testAddingImageWithoutExplicitName() : mixed

Test adding an image without explicitly adding a name for the image will set the name as the existing file name.

Returns

mixed —

testFailToAttach()

testFailToAttach(string  $path, string  $cid, string  $exceptionMessage, string  $name = '', string  $encoding = PHPMailer::ENCODING_BASE64) : mixed

Test that embedding an image fails in select use cases.

Parameters

string $path

Path to the attachment.

string $cid

Content ID for the attachment.

string $exceptionMessage

Unused in this test.

string $name

Optional. Attachment name to use.

string $encoding

Optional. File encoding to pass.

Returns

mixed —

testFailToAttachException()

testFailToAttachException(string  $path, string  $cid, string  $exceptionMessage, string  $name = '', string  $encoding = PHPMailer::ENCODING_BASE64) : mixed

Test that embedding an image throws an exception in select use cases.

Parameters

string $path

Path to the attachment.

string $cid

Content ID for the attachment.

string $exceptionMessage

The exception message to expect.

string $name

Optional. Attachment name to use.

string $encoding

Optional. File encoding to pass.

Returns

mixed —

dataFailToAttach()

dataFailToAttach() : array

Data provider.

Returns

array —

set_up()

set_up() : mixed

Run before each test is started.

Returns

mixed —

tear_down()

tear_down() : mixed

Run after each test is completed.

Returns

mixed —

resetStaticProperties()

resetStaticProperties() : mixed

Reset the static properties in the PHPMailer class to their default values.

Returns

mixed —

buildBody()

buildBody() : mixed

Build the body of the message in the appropriate format.

Returns

mixed —

checkChanges()

checkChanges() : mixed

Check which default settings have been changed for the report.

Returns

mixed —

addChange()

addChange(string  $sName, string  $sNewValue) : mixed

Add a changelog entry.

Parameters

string $sName
string $sNewValue

Returns

mixed —

addNote()

addNote(string  $sValue) : mixed

Adds a simple note to the message.

Parameters

string $sValue

Returns

mixed —

setAddress()

setAddress(string  $sAddress, string  $sName = '', string  $sType = 'to') : bool

Adds all of the addresses.

Parameters

string $sAddress
string $sName
string $sType

Returns

bool —