wiki.techinc.nl/tests/parser/ParserTestResult.php
Antoine Musso 9a90062eca test: abstract parser test result
This patch introduce the new ParserTestResult class which is meant to
represent the result of a parser test.  I have refactored some methods
to take advantage of this new class.

It just hold the test description and the actual/expected parser output.
A short isSuccess() method is provided for convenience, we can later
improve the class to carry more methods.

Change-Id: Ifb86e09451875dc119633b52d3f7e4f47c67cc60
2013-04-08 11:15:28 +02:00

42 lines
1,010 B
PHP

<?php
/**
* @copyright Copyright © 2013, Antoine Musso
* @copyright Copyright © 2013, Wikimedia Foundation Inc.
* @license GNU GPL v2
*
* @file
*/
/**
* Represent the result of a parser test.
*
* @since 1.22
*/
class ParserTestResult {
/**
* Description of the parser test.
*
* This is usually the text used to describe a parser test in the .txt
* files. It is initialized on a construction and you most probably
* never want to change it.
*/
public $description;
/** Text that was expected */
public $expected;
/** Actual text rendered */
public $actual;
/**
* @param $description string A short text describing the parser test
* usually the text in the parser test .txt file. The description
* is later available using the property $description.
*/
public function __construct( $description ) {
$this->description = $description;
}
/** Whether the test passed */
public function isSuccess() {
return ($this->expected === $this->actual);
}
}