3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 2.0.0
13 * @covers PHPUnit_Framework_TestCase
15 class Framework_TestListenerTest extends PHPUnit_Framework_TestCase implements PHPUnit_Framework_TestListener
18 protected $errorCount;
19 protected $failureCount;
20 protected $notImplementedCount;
21 protected $riskyCount;
22 protected $skippedCount;
24 protected $startCount;
26 public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
31 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
33 $this->failureCount++;
36 public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
38 $this->notImplementedCount++;
41 public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
46 public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
48 $this->skippedCount++;
51 public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
55 public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
59 public function startTest(PHPUnit_Framework_Test $test)
64 public function endTest(PHPUnit_Framework_Test $test, $time)
69 protected function setUp()
71 $this->result = new PHPUnit_Framework_TestResult;
72 $this->result->addListener($this);
75 $this->failureCount = 0;
76 $this->notImplementedCount = 0;
77 $this->riskyCount = 0;
78 $this->skippedCount = 0;
79 $this->startCount = 0;
82 public function testError()
84 $test = new TestError;
85 $test->run($this->result);
87 $this->assertEquals(1, $this->errorCount);
88 $this->assertEquals(1, $this->endCount);
91 public function testFailure()
94 $test->run($this->result);
96 $this->assertEquals(1, $this->failureCount);
97 $this->assertEquals(1, $this->endCount);
100 public function testStartStop()
103 $test->run($this->result);
105 $this->assertEquals(1, $this->startCount);
106 $this->assertEquals(1, $this->endCount);