PHP Class SimpleExpectation, simpletest

Also includes various helper methods.
Show file Open project: simpletest/simpletest Class Usage Examples

Protected Properties

Property Type Description
$dumper

Public Methods

Method Description
__construct ( string $message = '%s' ) Creates a dumper for displaying values and sets the test message.
isExpectation ( mixed $expectation ) : boolean Test to see if a value is an expectation object. A useful utility method.
overlayMessage ( mixed $compare, SimpleDumper $dumper ) : string Overlays the generated message onto the stored user message.
test ( mixed $compare ) : boolean Tests the expectation. True if correct.
testMessage ( mixed $compare ) : string Returns a human readable test message.

Protected Methods

Method Description
getDumper ( ) : SimpleDumper Accessor for the dumper.

Method Details

__construct() public method

Creates a dumper for displaying values and sets the test message.
public __construct ( string $message = '%s' )
$message string Customised message on failure.

getDumper() protected method

Accessor for the dumper.
protected getDumper ( ) : SimpleDumper
return SimpleDumper Current value dumper.

isExpectation() public static method

Test to see if a value is an expectation object. A useful utility method.
public static isExpectation ( mixed $expectation ) : boolean
$expectation mixed Hopefully an Expectation class.
return boolean True if descended from this class.

overlayMessage() public method

An additional message can be interjected.
public overlayMessage ( mixed $compare, SimpleDumper $dumper ) : string
$compare mixed Comparison value.
$dumper SimpleDumper For formatting the results.
return string Description of success or failure.

test() public method

Tests the expectation. True if correct.
public test ( mixed $compare ) : boolean
$compare mixed Comparison value.
return boolean True if correct.

testMessage() public method

Returns a human readable test message.
public testMessage ( mixed $compare ) : string
$compare mixed Comparison value.
return string Description of success or failure.

Property Details

$dumper protected property

protected $dumper