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 —

testEncodeString()

testEncodeString(string  $input, string  $expected, string  $encoding = null) : mixed

Encoding and charset tests.

Parameters

string $input

Text to encode.

string $expected

Expected function return value.

string $encoding

Optional. Encoding to use.

Returns

mixed —

dataEncodeString()

dataEncodeString() : array

Data provider.

Returns

array —

testInvalidEncoding()

testInvalidEncoding() : mixed

Test passing an incorrect encoding.

Returns

mixed —

testInvalidEncodingException()

testInvalidEncodingException() : mixed

Test passing an incorrect encoding results in an exception being thrown when PHPMailer is instantiated with `$exceptions = true`.

Returns

mixed —

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 —