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 —

testSetFromSuccess()

testSetFromSuccess(string  $expected, string  $address, string  $name = '') : mixed

Test succesfully setting the From, FromName and Sender properties.

Parameters

string $expected

Expected funtion output.

string $address

Email address input to pass to the function.

string $name

Optional. Name input to pass to the function.

Returns

mixed —

dataSetFromSuccess()

dataSetFromSuccess() : array

Data provider.

Returns

array —

testSetFromDoesNotOverruleSenderWithAutoFalse()

testSetFromDoesNotOverruleSenderWithAutoFalse() : mixed

Test setting the From address, but not overruling the Sender value when the $auto parameter is set to false.

Returns

mixed —

testSetFromDoesNotOverruleExistingSender()

testSetFromDoesNotOverruleExistingSender() : mixed

Test setting the From address, but not overruling an existing, non-empty Sender value.

Returns

mixed —

testSetFromFail()

testSetFromFail(string  $address, string  $name = '') : mixed

Test unsuccesfully setting the From, FromName and Sender properties.

Parameters

string $address

Email address input to pass to the function.

string $name

Optional. Name input to pass to the function.

Returns

mixed —

testInvalidAddressException()

testInvalidAddressException(string  $address, string  $name = '') : mixed

Test that setting an invalid email address results in an exception.

Parameters

string $address

Email address input to pass to the function.

string $name

Optional. Name input to pass to the function.

Returns

mixed —

dataSetFromFail()

dataSetFromFail() : array

Data provider.

Returns

array —

testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions()

testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions() : mixed

Test unsuccesfully setting the From, FromName and Sender properties when an email address containing an 8bit character is passed and either the MbString or the Intl extension are not available.

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 —