File: Console_TestListener.php

package info (click to toggle)
php-html-template-it 1.10-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 232 kB
  • ctags: 461
  • sloc: php: 952; makefile: 28
file content (32 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class Console_TestListener extends PHPUnit_TestListener {
    function addError(&$test, &$t) {
        $this->_errors += 1;
        echo " Error $this->_errors in " . $test->getName() . " : $t\n";
    }

    function addFailure(&$test, &$t) {
        $this->_fails += 1;
        if ($this->_fails == 1) {
            echo "\n";
        }
        echo "Failure $this->_fails : $t\n";
    }

    function endTest(&$test) {
        if ($this->_fails == 0 && $this->_errors == 0) {
            echo ' Test passed';
        } else {
            echo "There were $this->_fails failures for " . $test->getName() . "\n";
            echo "There were $this->_errors errors for " . $test->getName() . "\n";
        }
        echo "\n";
    }

    function startTest(&$test) {
        $this->_fails = 0;
        $this->_errors = 0;
        echo get_class($test) . " : Starting " . $test->getName() .  " ...";
    }
}
?>