SimpleTest showing description of error
The assert* methods of SimpleTest allow an optional additional parameter which is the description of the current assertion. In case of failure it will be shown instead of the details of the error
<?php
require_once(dirname(__FILE__) . '/../../../tools/simpletest/autorun.php');
require_once(dirname(__FILE__) . '/../includes/mylib.php');
class TestOfAdd extends UnitTestCase {
function testAdd() {
$this->assertEqual(add(1,1), 2, "1+1");
$this->assertEqual(add(2,2), 4, "2+2");
$this->assertEqual(add(1,1,1), 3, "three params 1+1+1");
}
}
?>
Output:
{% embed include file="src/examples/php/simpletest/st04.txt)
With the last row being RED