Debian Codegraph @

tests/parser/MultiTestRecorder.php

raw symbols SCIP
1 <?php
2
3 use Wikimedia\Parsoid\ParserTests\Test as ParserTest;
4 use Wikimedia\Parsoid\ParserTests\TestMode as ParserTestMode;
5
6 /**
7 * This is a TestRecorder representing a collection of other TestRecorders.
8 * It proxies calls to all constituent objects.
9 */
10 class MultiTestRecorder extends TestRecorder {
11 /** @var TestRecorder[] */
12 private $recorders = [];
13
14 public function addRecorder( TestRecorder $recorder ) {
15 $this->recorders[] = $recorder;
16 }
17
18 private function proxy( $funcName, $args ) {
19 foreach ( $this->recorders as $recorder ) {
20 $recorder->$funcName( ...$args );
21 }
22 }
23
24 public function start() {
25 $this->proxy( __FUNCTION__, func_get_args() );
26 }
27
28 public function startTest( ParserTest $test, ParserTestMode $mode ) {
29 $this->proxy( __FUNCTION__, func_get_args() );
30 }
31
32 public function startSuite( string $path ) {
33 $this->proxy( __FUNCTION__, func_get_args() );
34 }
35
36 public function endSuite( string $path ) {
37 $this->proxy( __FUNCTION__, func_get_args() );
38 }
39
40 public function record( ParserTestResult $result ) {
41 $this->proxy( __FUNCTION__, func_get_args() );
42 }
43
44 public function warning( string $message ) {
45 $this->proxy( __FUNCTION__, func_get_args() );
46 }
47
48 public function skipped( ParserTest $test, ParserTestMode $mode, string $reason ) {
49 $this->proxy( __FUNCTION__, func_get_args() );
50 }
51
52 public function report() {
53 $this->proxy( __FUNCTION__, func_get_args() );
54 }
55
56 public function end() {
57 $this->proxy( __FUNCTION__, func_get_args() );
58 }
59 }