summaryrefslogtreecommitdiff
path: root/www/wiki/tests/parser/ParserTestResult.php
blob: 6396a0189576f67ba972dbe78c621d66e45c232e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
 * @file
 *
 * @copyright Copyright © 2013, Antoine Musso
 * @copyright Copyright © 2013, Wikimedia Foundation Inc.
 */

/**
 * Represent the result of a parser test.
 *
 * @since 1.22
 */
class ParserTestResult {
	/** The test info array */
	public $test;
	/** Text that was expected */
	public $expected;
	/** Actual text rendered */
	public $actual;

	/**
	 * @param array $test The test info array from TestIterator
	 * @param string $expected The normalized expected output
	 * @param string $actual The actual output
	 */
	public function __construct( $test, $expected, $actual ) {
		$this->test = $test;
		$this->expected = $expected;
		$this->actual = $actual;
	}

	/**
	 * Whether the test passed
	 * @return bool
	 */
	public function isSuccess() {
		return $this->expected === $this->actual;
	}

	public function getDescription() {
		return $this->test['desc'];
	}
}