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 —

testAddReplyToValidAddressNonIdn()

testAddReplyToValidAddressNonIdn(string  $address, string  $name = null, string  $expected = null) : mixed

Test adding a non-IDN reply-to address.

Parameters

string $address

The email address to set.

string $name

Optional. The name to set.

string $expected

Optional. The email address and name as they are expected to be set. Only needs to be passed if different than the original inputs.

Returns

mixed —

dataAddReplyToValidAddressNonIdn()

dataAddReplyToValidAddressNonIdn() : array

Data provider.

Returns

array —

testAddReplyToInvalidAddressNonIdn()

testAddReplyToInvalidAddressNonIdn(string  $address) : mixed

Test adding an invalid non-IDN reply-to address.

Parameters

string $address

The email address to set.

Returns

mixed —

testAddReplyToInvalidAddressNonIdnException()

testAddReplyToInvalidAddressNonIdnException(string  $address) : mixed

Test receiving an excepting when adding an invalid non-IDN reply-to address.

Parameters

string $address

The email address to set.

Returns

mixed —

dataAddReplyToInvalidAddressNonIdn()

dataAddReplyToInvalidAddressNonIdn() : array

Data provider.

Returns

array —

testReplyToInMessageHeader()

testReplyToInMessageHeader(string  $addresses, string  $expected) : mixed

Test that the correct Reply-To message header has been added to the message.

Parameters

string $addresses

The email address(es) to set for Reply-To.

string $expected

The expected message header.

Returns

mixed —

dataReplyToInMessageHeader()

dataReplyToInMessageHeader() : array

Data provider.

Returns

array —

testEnqueueAndAddIdnAddress()

testEnqueueAndAddIdnAddress() : mixed

Tests handling of IDN reply-to addresses.

Verifies that:

  • CharSet and Unicode -> ASCII conversions for addresses with IDN gets executed correctly.
  • IDN addresses initially get enqueued.
  • IDN addresses correctly get added during preSend().

Returns

mixed —

testNoDuplicateReplyToAddresses()

testNoDuplicateReplyToAddresses() : mixed

Tests that non-exact duplicate reply-to addresses do get enqueued (IDN), but don't get added (IDN converted to punycode + non-IDN).

Returns

mixed —

testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions()

testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions() : mixed

Test unsuccesfully adding an Reply-to address when an email address containing an 8bit character is passed and either the MbString or the Intl extension are not available.

Returns

mixed —

testClearReplyTos()

testClearReplyTos() : mixed

Test successfully clearing out both the added as well as the queued Reply-to addresses.

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 —