LoginTestCase.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @package login
  4. * @subpackage test
  5. */
  6. /**
  7. * Extends the basic PHPUnit TestCase class to provide Login specific methods
  8. *
  9. * @package login
  10. * @subpackage test
  11. */
  12. class LoginTestCase extends PHPUnit_Framework_TestCase {
  13. /**
  14. * @var modX $modx
  15. */
  16. protected $modx = null;
  17. /**
  18. * @var Login $login
  19. */
  20. protected $login = null;
  21. /**
  22. * Ensure all tests have a reference to the MODX and Quip objects
  23. */
  24. public function setUp() {
  25. $this->modx =& LoginTestHarness::_getConnection();
  26. $corePath = $this->modx->getOption('login.core_path',null,$this->modx->getOption('core_path',null,MODX_CORE_PATH).'components/login/');
  27. require_once $corePath.'model/login/login.class.php';
  28. $this->login = new Login($this->modx);
  29. /* set this here to prevent emails/headers from being sent */
  30. $this->login->inTestMode = true;
  31. /* make sure to reset MODX placeholders so as not to keep placeholder data across tests */
  32. $this->modx->placeholders = array();
  33. $this->modx->login =& $this->login;
  34. error_reporting(E_ALL);
  35. }
  36. /**
  37. * Remove reference at end of test case
  38. */
  39. public function tearDown() {
  40. $this->modx = null;
  41. $this->login = null;
  42. }
  43. }