parent = $parent; $this->term = $parent->term; } function start() { $this->total = 0; $this->success = 0; } function record( $test, $subtest, $result ) { $this->total++; $this->success += ( $result ? 1 : 0 ); } function end() { // dummy } function report() { if ( $this->total > 0 ) { $this->reportPercentage( $this->success, $this->total ); } else { throw new MWException( "No tests found.\n" ); } } function reportPercentage( $success, $total ) { $ratio = wfPercent( 100 * $success / $total ); print $this->term->color( 1 ) . "Passed $success of $total tests ($ratio)... "; if ( $success == $total ) { print $this->term->color( 32 ) . "ALL TESTS PASSED!"; } else { $failed = $total - $success; print $this->term->color( 31 ) . "$failed tests failed!"; } print $this->term->reset() . "\n"; return ( $success == $total ); } }