MultiTestRecorder.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * This is a TestRecorder representing a collection of other TestRecorders.
  4. * It proxies calls to all constituent objects.
  5. */
  6. class MultiTestRecorder extends TestRecorder {
  7. private $recorders = [];
  8. public function addRecorder( TestRecorder $recorder ) {
  9. $this->recorders[] = $recorder;
  10. }
  11. private function proxy( $funcName, $args ) {
  12. foreach ( $this->recorders as $recorder ) {
  13. call_user_func_array( [ $recorder, $funcName ], $args );
  14. }
  15. }
  16. public function start() {
  17. $this->proxy( __FUNCTION__, func_get_args() );
  18. }
  19. public function startTest( $test ) {
  20. $this->proxy( __FUNCTION__, func_get_args() );
  21. }
  22. public function startSuite( $path ) {
  23. $this->proxy( __FUNCTION__, func_get_args() );
  24. }
  25. public function endSuite( $path ) {
  26. $this->proxy( __FUNCTION__, func_get_args() );
  27. }
  28. public function record( $test, ParserTestResult $result ) {
  29. $this->proxy( __FUNCTION__, func_get_args() );
  30. }
  31. public function warning( $message ) {
  32. $this->proxy( __FUNCTION__, func_get_args() );
  33. }
  34. public function skipped( $test, $subtest ) {
  35. $this->proxy( __FUNCTION__, func_get_args() );
  36. }
  37. public function report() {
  38. $this->proxy( __FUNCTION__, func_get_args() );
  39. }
  40. public function end() {
  41. $this->proxy( __FUNCTION__, func_get_args() );
  42. }
  43. }