Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / tests / parser / ParserTestResult.php
1 <?php
2 /**
3 * @file
4 *
5 * @copyright Copyright © 2013, Antoine Musso
6 * @copyright Copyright © 2013, Wikimedia Foundation Inc.
7 */
8
9 /**
10 * Represent the result of a parser test.
11 *
12 * @since 1.22
13 */
14 class ParserTestResult {
15 /** The test info array */
16 public $test;
17 /** Text that was expected */
18 public $expected;
19 /** Actual text rendered */
20 public $actual;
21
22 /**
23 * @param array $test The test info array from TestIterator
24 * @param string $expected The normalized expected output
25 * @param string $actual The actual output
26 */
27 public function __construct( $test, $expected, $actual ) {
28 $this->test = $test;
29 $this->expected = $expected;
30 $this->actual = $actual;
31 }
32
33 /**
34 * Whether the test passed
35 * @return bool
36 */
37 public function isSuccess() {
38 return $this->expected === $this->actual;
39 }
40
41 public function getDescription() {
42 return $this->test['desc'];
43 }
44 }