PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/includes/die-handler.php

https://github.com/keha76/Easy-Digital-Downloads
PHP | 32 lines | 17 code | 4 blank | 11 comment | 0 complexity | cf1a58773cdad5e9f6a98f2ab6792bd5 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. * Override the die handlers.
  4. *
  5. * Easy Digital Downloads uses the edd_die() function to die/exit the script
  6. * which is a simple wrapper for calling the wp_die() function, this class simply
  7. * overrides that die calls by returning false allowing us to make assertions when
  8. * edd_die() is called, for example in the AJAX functions or the API functions.
  9. *
  10. * @package EDD_Unit_Tests
  11. * @author Sunny Ratilal
  12. */
  13. class EDD_Die_Handler {
  14. public $die = false;
  15. public function __construct() {
  16. $this->die_handler();
  17. }
  18. public function die_handler() {
  19. define( 'EDD_UNIT_TESTS', true );
  20. $this->die = true;
  21. }
  22. public function died() {
  23. return $this->die;
  24. }
  25. public function reset() {
  26. $this->die = false;
  27. }
  28. }