Home » Testing » PHPUnit » Bug #5883
addPassedTest does not notify listeners
Details
| Submitted | 2005-11-07 10:01 UTC |
|---|---|
| From | pb at asl-electronics dot co dot uk |
| Status | Bogus |
| Package | PHPUnit |
| PHP Version | 5.0.4 |
| OS | Win 2K |
| Roadmaps | (Not assigned) |
Comments
[2005-11-07 10:01 UTC] pb at asl-electronics dot co dot uk
Description:
------------
File:
PHPUnit/TestResult
In function:
PHPUnit_TestResult::addPassedTest
Function does not notify listeners with addPassedTest.
Test script:
---------------
class MyTest extends PHPUnit_TestCase {
function MyTest($name) {
$this->PHPUnit_TestCase($name);
}
function testFoo() {
$this->assertTrue(TRUE);
}
};
class MyListener extends PHPUnit_TestListener {
function addPassedTest(&$test) {
print $test->getName()." passed.\n\n";
}
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('MyTest');
$result = new PHPUnit_TestResult();
$result->addListener(new MyListener);
$suite->run($result);
Expected result:
----------------
testFoo passed.
[2005-11-10 09:38 UTC] sebastian at php dot net
Thank you for taking the time to write to us, but this is not
a bug.
The PHPUnit_TestListener "interface" (there are not interfaces in PHP 4) does not declare an addPassedTest() method.
The method you are looking for is endTest().