ResultPrinter.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. namespace mindplay\test\lib\ResultPrinter;
  3. use mindplay\test\lib\xTest;
  4. use mindplay\test\lib\xTestRunner;
  5. abstract class ResultPrinter
  6. {
  7. /**
  8. * Prints the header before the test output.
  9. *
  10. * @param xTestRunner $testRunner Test runner.
  11. * @param string $pattern Test filename pattern.
  12. * @return void
  13. */
  14. public function suiteHeader(xTestRunner $testRunner, $pattern)
  15. {
  16. }
  17. /**
  18. * Prints the footer after the test output.
  19. *
  20. * @param xTestRunner $testRunner Test runner.
  21. * @return void
  22. */
  23. public function suiteFooter(xTestRunner $testRunner)
  24. {
  25. }
  26. /**
  27. * Creates code coverage report.
  28. *
  29. * @param \PHP_CodeCoverage $coverage Code coverage collector.
  30. * @return void
  31. */
  32. public function createCodeCoverageReport(\PHP_CodeCoverage $coverage = null)
  33. {
  34. }
  35. /**
  36. * Prints test header.
  37. *
  38. * @param xTest $test Test.
  39. * @return void
  40. */
  41. public function testHeader(xTest $test)
  42. {
  43. }
  44. /**
  45. * Prints test footer.
  46. *
  47. * @param xTest $test Test.
  48. * @param integer $total Total test case count.
  49. * @param integer $passed Passed test case count.
  50. * @return void
  51. */
  52. public function testFooter(xTest $test, $total, $passed)
  53. {
  54. }
  55. /**
  56. * Test case result.
  57. *
  58. * @param \ReflectionMethod $testCaseMethod Test case method.
  59. * @param string $resultColor Result color.
  60. * @param string $resultMessage Result message.
  61. * @return void
  62. */
  63. public function testCaseResult(\ReflectionMethod $testCaseMethod, $resultColor, $resultMessage)
  64. {
  65. }
  66. /**
  67. * Returns test case name.
  68. *
  69. * @param \ReflectionMethod $testCaseMethod Test case method.
  70. * @param boolean $humanFormat Use human format.
  71. * @return string
  72. */
  73. protected function getTestCaseName(\ReflectionMethod $testCaseMethod, $humanFormat = false)
  74. {
  75. $ret = substr($testCaseMethod->name, 4);
  76. return $humanFormat ? ltrim(preg_replace('/([A-Z])/', ' \1', $ret)) : $ret;
  77. }
  78. }