diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/parser/MultiTestRecorder.php |
first commit
Diffstat (limited to 'www/wiki/tests/parser/MultiTestRecorder.php')
-rw-r--r-- | www/wiki/tests/parser/MultiTestRecorder.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/www/wiki/tests/parser/MultiTestRecorder.php b/www/wiki/tests/parser/MultiTestRecorder.php new file mode 100644 index 00000000..5fbfecf8 --- /dev/null +++ b/www/wiki/tests/parser/MultiTestRecorder.php @@ -0,0 +1,55 @@ +<?php + +/** + * This is a TestRecorder representing a collection of other TestRecorders. + * It proxies calls to all constituent objects. + */ +class MultiTestRecorder extends TestRecorder { + private $recorders = []; + + public function addRecorder( TestRecorder $recorder ) { + $this->recorders[] = $recorder; + } + + private function proxy( $funcName, $args ) { + foreach ( $this->recorders as $recorder ) { + call_user_func_array( [ $recorder, $funcName ], $args ); + } + } + + public function start() { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function startTest( $test ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function startSuite( $path ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function endSuite( $path ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function record( $test, ParserTestResult $result ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function warning( $message ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function skipped( $test, $subtest ) { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function report() { + $this->proxy( __FUNCTION__, func_get_args() ); + } + + public function end() { + $this->proxy( __FUNCTION__, func_get_args() ); + } +} |