ResultPrinter.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace Codeception\PHPUnit;
  3. use \PHPUnit\Framework\AssertionFailedError;
  4. use \PHPUnit\Framework\Test;
  5. use \PHPUnit\Runner\BaseTestRunner;
  6. class ResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter
  7. {
  8. /**
  9. * An error occurred.
  10. *
  11. * @param \PHPUnit\Framework\Test $test
  12. * @param \Exception $e
  13. * @param float $time
  14. */
  15. public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
  16. {
  17. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR;
  18. $this->failed++;
  19. }
  20. /**
  21. * A failure occurred.
  22. *
  23. * @param \PHPUnit\Framework\Test $test
  24. * @param \PHPUnit\Framework\AssertionFailedError $e
  25. * @param float $time
  26. */
  27. public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
  28. {
  29. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE;
  30. $this->failed++;
  31. }
  32. /**
  33. * A warning occurred.
  34. *
  35. * @param \PHPUnit\Framework\Test $test
  36. * @param \PHPUnit\Framework\Warning $e
  37. * @param float $time
  38. */
  39. public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time)
  40. {
  41. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_WARNING;
  42. $this->warned++;
  43. }
  44. /**
  45. * Incomplete test.
  46. *
  47. * @param \PHPUnit\Framework\Test $test
  48. * @param \Exception $e
  49. * @param float $time
  50. */
  51. public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
  52. {
  53. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE;
  54. $this->incomplete++;
  55. }
  56. /**
  57. * Risky test.
  58. *
  59. * @param \PHPUnit\Framework\Test $test
  60. * @param \Exception $e
  61. * @param float $time
  62. *
  63. * @since Method available since Release 4.0.0
  64. */
  65. public function addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
  66. {
  67. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY;
  68. $this->risky++;
  69. }
  70. /**
  71. * Skipped test.
  72. *
  73. * @param \PHPUnit\Framework\Test $test
  74. * @param \Exception $e
  75. * @param float $time
  76. *
  77. * @since Method available since Release 3.0.0
  78. */
  79. public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
  80. {
  81. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED;
  82. $this->skipped++;
  83. }
  84. public function startTest(\PHPUnit\Framework\Test $test)
  85. {
  86. $this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_PASSED;
  87. }
  88. }