LimeOutputInterface.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /*
  3. * This file is part of the Lime test framework.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. * (c) Bernhard Schussek <bernhard.schussek@symfony-project.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. /**
  12. * Specifies how the results of an executed test should be presented.
  13. *
  14. * The class LimeTest uses an output to communicate the results of a test to
  15. * the user or to a different application. All outputs must implement this
  16. * interface.
  17. *
  18. * One output instance may receive test results of one or many test files.
  19. * Each time when the output switches context between one test file and
  20. * another, the method focus() is called with the name of the new test file.
  21. * Once the file has been processed completely, the method close() is called
  22. * to allow the output to finalize the results for the active test script.
  23. *
  24. * Depending on whether the output supports threading (parallel inputs from
  25. * different actively tested files) the method supportsThreading() should
  26. * return TRUE or FALSE.
  27. *
  28. * @package Lime
  29. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  30. * @version SVN: $Id: LimeOutputInterface.php 23701 2009-11-08 21:23:40Z bschussek $
  31. */
  32. interface LimeOutputInterface
  33. {
  34. /**
  35. * Returns whether this output supports processing results from different tests
  36. * simultaneously.
  37. *
  38. * @return boolean
  39. */
  40. public function supportsThreading();
  41. /**
  42. * Focuses the output on the given test file.
  43. *
  44. * All inputs until the next call to focus() concern this test file.
  45. *
  46. * @param string$file
  47. */
  48. public function focus($file);
  49. /**
  50. * Closes the output for the currently focused test file.
  51. */
  52. public function close();
  53. /**
  54. * Sets the plan for the currently focused test file.
  55. *
  56. * The plan is the expected number of tests.0
  57. *
  58. * @param integer $amount
  59. */
  60. public function plan($amount);
  61. /**
  62. * Informs the output about a successful test.
  63. *
  64. * @param string $message The test message
  65. * @param string $file The file in which the successful test occured
  66. * @param integer $line The line of the file
  67. */
  68. public function pass($message, $file, $line);
  69. /**
  70. * Informs the output about a failed test with an optional failure reason.
  71. *
  72. * @param string $message The test message
  73. * @param string $file The file in which the failed test occured
  74. * @param integer $line The line of the file
  75. * @param string $error The reason why the test failed
  76. */
  77. public function fail($message, $file, $line, $error = null);
  78. /**
  79. * Informs the output about a skipped test.
  80. *
  81. * @param string $message The test message
  82. * @param string $file The file in which the skipped test occured
  83. * @param integer $line The line of the file
  84. */
  85. public function skip($message, $file, $line);
  86. /**
  87. * Informs the output about a todo.
  88. *
  89. * @param string $message The todo message
  90. * @param string $file The file in which the todo occured
  91. * @param integer $line The line of the file
  92. */
  93. public function todo($message, $file, $line);
  94. /**
  95. * Informs the output about a warning.
  96. *
  97. * @param string $message The warning message
  98. * @param string $file The file in which the warning occured
  99. * @param integer $line The line of the file
  100. */
  101. public function warning($message, $file, $line);
  102. /**
  103. * Informs the output about an error.
  104. *
  105. * @param LimeError $error The error that occurred
  106. */
  107. public function error(LimeError $error);
  108. /**
  109. * Informs the output about a comment.
  110. *
  111. * @param string $message The comment message
  112. */
  113. public function comment($message);
  114. /**
  115. * Flushes the test outputs to the console.
  116. */
  117. public function flush();
  118. }