PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Component/AbstractTest.php

https://github.com/andreaswolf/Menta
PHP | 38 lines | 14 code | 4 blank | 20 comment | 1 complexity | 7eae9ac923b98085ac338eda2288335b MD5 | raw file
  1. <?php
  2. /**
  3. * Abstract component class for components that need access to the current PHPUnit testcase
  4. *
  5. * @author Fabrizio Branca
  6. * @since 2011-11-24
  7. */
  8. abstract class Menta_Component_AbstractTest extends Menta_Component_Abstract {
  9. /**
  10. * @var PHPUnit_Framework_TestCase
  11. */
  12. protected $test;
  13. /**
  14. * Set test object
  15. *
  16. * @param PHPUnit_Framework_TestCase $test
  17. * @return Menta_Component_Helper_Assert
  18. */
  19. public function setTest(PHPUnit_Framework_TestCase $test) {
  20. $this->test = $test;
  21. return $this;
  22. }
  23. /**
  24. * Get test object
  25. *
  26. * @return PHPUnit_Framework_TestCase
  27. */
  28. public function getTest() {
  29. if (is_null($this->test)) {
  30. throw new Exception('No testcase object available');
  31. }
  32. return $this->test;
  33. }
  34. }