PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Testing » PHPUnit » Bug #5883

addPassedTest does not notify listeners

Details

Submitted2005-11-07 10:01 UTC
Frompb at asl-electronics dot co dot uk
StatusBogus
PackagePHPUnit
PHP Version5.0.4
OSWin 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().