class PHPUnit_Framework_TestFailure (View source)

A TestFailure collects a failed test together with the caught exception.

Properties

protected PHPUnit_Framework_Test|null $failedTest
protected Exception $thrownException

Methods

__construct(PHPUnit_Framework_Test $failedTest, Throwable $t)

Constructs a TestFailure with the given test and exception.

string
toString()

Returns a short description of the failure.

string
getExceptionAsString()

Returns a description for the thrown exception.

static string
exceptionToString(Exception $e)

Returns a description for an exception.

string
getTestName()

Returns the name of the failing test (including data set, if any).

failedTest()

Returns the failing test.

thrownException()

Gets the thrown exception.

string
exceptionMessage()

Returns the exception's message.

bool
isFailure()

Returns true if the thrown exception is of type AssertionFailedError.

Details

__construct(PHPUnit_Framework_Test $failedTest, Throwable $t)

Constructs a TestFailure with the given test and exception.

Parameters

PHPUnit_Framework_Test $failedTest
Throwable $t

string toString()

Returns a short description of the failure.

Return Value

string

string getExceptionAsString()

Returns a description for the thrown exception.

Return Value

string

static string exceptionToString(Exception $e)

Returns a description for an exception.

Parameters

Exception $e

Return Value

string

string getTestName()

Returns the name of the failing test (including data set, if any).

Return Value

string

PHPUnit_Framework_Test|null failedTest()

Returns the failing test.

Note: The test object is not set when the test is executed in process isolation.

Return Value

PHPUnit_Framework_Test|null

See also

PHPUnit_Framework_Exception

Exception thrownException()

Gets the thrown exception.

Return Value

Exception

string exceptionMessage()

Returns the exception's message.

Return Value

string

bool isFailure()

Returns true if the thrown exception is of type AssertionFailedError.

Return Value

bool