EqualExpectation::testMessage PHP Method

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.
    public function testMessage($compare)
    {
        if ($this->test($compare)) {
            return 'Equal expectation [' . $this->dumper->describeValue($this->value) . ']';
        } else {
            return 'Equal expectation fails ' . $this->dumper->describeDifference($this->value, $compare);
        }
    }

Usage Example

Exemplo n.º 1
0
 function testNestedHash()
 {
     $tree = new EqualExpectation(array("a" => 1, "b" => array("c" => 2, "d" => "Three")));
     $this->assertPattern('/member.*?\\[b\\].*?\\[d\\].*?at character 5/', $tree->testMessage(array("a" => 1, "b" => array("c" => 2, "d" => "Threeish"))));
 }