ParserTestResult.php 890 B

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