SimpleTest.php 2.1 KB

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