3 class MediaWikiPHPUnitTestListener
implements PHPUnit_Framework_TestListener
{
9 public function __construct( $logChannel ) {
10 $this->logChannel
= $logChannel;
13 protected function getTestName( PHPUnit_Framework_Test
$test ) {
14 $name = get_class( $test );
16 if ( $test instanceof PHPUnit_Framework_TestCase
) {
17 $name .= '::' . $test->getName( true );
23 protected function getErrorName( Exception
$exception ) {
24 $name = get_class( $exception );
25 $name = "[$name] " . $exception->getMessage();
33 * @param PHPUnit_Framework_Test $test
37 public function addError( PHPUnit_Framework_Test
$test, Exception
$e, $time ) {
40 'ERROR in ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
47 * @param PHPUnit_Framework_Test $test
48 * @param PHPUnit_Framework_AssertionFailedError $e
51 public function addFailure( PHPUnit_Framework_Test
$test,
52 PHPUnit_Framework_AssertionFailedError
$e, $time
56 'FAILURE in ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
63 * @param PHPUnit_Framework_Test $test
67 public function addIncompleteTest( PHPUnit_Framework_Test
$test, Exception
$e, $time ) {
70 'Incomplete test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
77 * @param PHPUnit_Framework_Test $test
81 * @since Method available since Release 3.0.0
83 public function addSkippedTest( PHPUnit_Framework_Test
$test, Exception
$e, $time ) {
86 'Skipped test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
91 * A test suite started.
93 * @param PHPUnit_Framework_TestSuite $suite
94 * @since Method available since Release 2.2.0
96 public function startTestSuite( PHPUnit_Framework_TestSuite
$suite ) {
97 wfDebugLog( $this->logChannel
, 'START suite ' . $suite->getName() );
101 * A test suite ended.
103 * @param PHPUnit_Framework_TestSuite $suite
104 * @since Method available since Release 2.2.0
106 public function endTestSuite( PHPUnit_Framework_TestSuite
$suite ) {
107 wfDebugLog( $this->logChannel
, 'END suite ' . $suite->getName() );
113 * @param PHPUnit_Framework_Test $test
115 public function startTest( PHPUnit_Framework_Test
$test ) {
116 wfDebugLog( $this->logChannel
, 'Start test ' . $this->getTestName( $test ) );
122 * @param PHPUnit_Framework_Test $test
125 public function endTest( PHPUnit_Framework_Test
$test, $time ) {
126 wfDebugLog( $this->logChannel
, 'End test ' . $this->getTestName( $test ) );