You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.1KB

  1. <?php
  2. /**
  3. * Proxies results from PHPT_Reporter to SimpleTest's reporter
  4. */
  5. class PHPT_Reporter_SimpleTest implements PHPT_Reporter
  6. {
  7. /** SimpleTest reporter to proxy results to */
  8. protected $reporter;
  9. /** @param SimpleTest reporter */
  10. public function __construct($reporter)
  11. {
  12. $this->reporter = $reporter;
  13. }
  14. // TODO: Figure out what the proper calls should be, since we've given
  15. // each Suite its own UnitTestCase controller
  16. /**
  17. * Called when the Reporter is started from a PHPT_Suite
  18. * @todo Figure out if Suites can be named
  19. */
  20. public function onSuiteStart(PHPT_Suite $suite)
  21. {
  22. //$this->reporter->paintGroupStart('PHPT Suite', $suite->count());
  23. }
  24. /**
  25. * Called when the Reporter is finished in a PHPT_Suite
  26. */
  27. public function onSuiteEnd(PHPT_Suite $suite)
  28. {
  29. //$this->reporter->paintGroupEnd('PHPT Suite');
  30. }
  31. /**
  32. * Called when a Case is started
  33. */
  34. public function onCaseStart(PHPT_Case $case)
  35. {
  36. //$this->reporter->paintCaseStart($case->name);
  37. }
  38. /**
  39. * Called when a Case ends
  40. */
  41. public function onCaseEnd(PHPT_Case $case)
  42. {
  43. //$this->reporter->paintCaseEnd($case->name);
  44. }
  45. /**
  46. * Called when a Case runs without Exception
  47. */
  48. public function onCasePass(PHPT_Case $case)
  49. {
  50. $this->reporter->paintPass("{$case->name} in {$case->filename}");
  51. }
  52. /**
  53. * Called when a PHPT_Case_VetoException is thrown during a Case's run()
  54. */
  55. public function onCaseSkip(PHPT_Case $case, PHPT_Case_VetoException $veto)
  56. {
  57. $this->reporter->paintSkip($veto->getMessage() . ' [' . $case->filename .']');
  58. }
  59. /**
  60. * Called when any Exception other than a PHPT_Case_VetoException is encountered
  61. * during a Case's run()
  62. */
  63. public function onCaseFail(PHPT_Case $case, PHPT_Case_FailureException $failure)
  64. {
  65. $this->reporter->paintFail($failure->getReason());
  66. }
  67. public function onParserError(Exception $exception)
  68. {
  69. $this->reporter->paintException($exception);
  70. }
  71. }
  72. // vim: et sw=4 sts=4