LimeOutputInspectable.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /*
  3. * This file is part of the Lime 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. class LimeOutputInspectable implements LimeOutputInterface
  12. {
  13. private
  14. $output = null,
  15. $planned = 0,
  16. $passed = 0,
  17. $failed = 0,
  18. $skipped = 0,
  19. $todos = 0,
  20. $errors = 0,
  21. $warnings = 0,
  22. $failedFiles = array();
  23. public function __construct(LimeOutputInterface $output = null)
  24. {
  25. $this->output = is_null($output) ? new LimeOutputNone() : $output;
  26. }
  27. public function supportsThreading()
  28. {
  29. return $this->output->supportsThreading();
  30. }
  31. public function getPlanned()
  32. {
  33. return $this->planned;
  34. }
  35. public function getPassed()
  36. {
  37. return $this->passed;
  38. }
  39. public function getFailed()
  40. {
  41. return $this->failed;
  42. }
  43. public function getSkipped()
  44. {
  45. return $this->skipped;
  46. }
  47. public function getTodos()
  48. {
  49. return $this->todos;
  50. }
  51. public function getErrors()
  52. {
  53. return $this->errors;
  54. }
  55. public function getWarnings()
  56. {
  57. return $this->warnings;
  58. }
  59. public function getFailedFiles()
  60. {
  61. return $this->failedFiles;
  62. }
  63. public function focus($file)
  64. {
  65. $this->output->focus($file);
  66. }
  67. public function close()
  68. {
  69. $this->output->close();
  70. }
  71. public function plan($amount)
  72. {
  73. $this->planned += $amount;
  74. $this->output->plan($amount);
  75. }
  76. public function pass($message, $file, $line)
  77. {
  78. $this->passed++;
  79. $this->output->pass($message, $file, $line);
  80. }
  81. public function fail($message, $file, $line, $error = null)
  82. {
  83. $this->failed++;
  84. $this->failedFiles[] = $file;
  85. $this->output->fail($message, $file, $line, $error);
  86. }
  87. public function skip($message, $file, $line)
  88. {
  89. $this->skipped++;
  90. $this->output->skip($message, $file, $line);
  91. }
  92. public function todo($message, $file, $line)
  93. {
  94. $this->todos++;
  95. $this->output->todo($message, $file, $line);
  96. }
  97. public function warning($message, $file, $line)
  98. {
  99. $this->warnings++;
  100. $this->failedFiles[] = $file;
  101. $this->output->warning($message, $file, $line);
  102. }
  103. public function error(LimeError $error)
  104. {
  105. $this->errors++;
  106. $this->failedFiles[] = $error->getFile();
  107. $this->output->error($error);
  108. }
  109. public function comment($message)
  110. {
  111. $this->output->comment($message);
  112. }
  113. public function flush()
  114. {
  115. $this->output->flush();
  116. }
  117. }