bootstrap_phpunit.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // Load the PUPUnit Autoloader
  3. include_once('PHPUnit/Autoload.php');
  4. /**
  5. * Set error reporting and display errors settings. You will want to change these when in production.
  6. */
  7. error_reporting(E_ALL);
  8. ini_set('display_errors', 1);
  9. $app_path = rtrim($_SERVER['app_path'], '/').'/';
  10. $package_path = rtrim($_SERVER['package_path'], '/').'/';
  11. $core_path = rtrim($_SERVER['core_path'], '/').'/';
  12. /**
  13. * Website docroot
  14. */
  15. define('DOCROOT', realpath(__DIR__.DIRECTORY_SEPARATOR.$_SERVER['doc_root']).DIRECTORY_SEPARATOR);
  16. ( ! is_dir($app_path) and is_dir(DOCROOT.$app_path)) and $app_path = DOCROOT.$app_path;
  17. ( ! is_dir($core_path) and is_dir(DOCROOT.$core_path)) and $core_path = DOCROOT.$core_path;
  18. ( ! is_dir($package_path) and is_dir(DOCROOT.$package_path)) and $package_path = DOCROOT.$package_path;
  19. define('APPPATH', realpath($app_path).DIRECTORY_SEPARATOR);
  20. define('PKGPATH', realpath($package_path).DIRECTORY_SEPARATOR);
  21. define('COREPATH', realpath($core_path).DIRECTORY_SEPARATOR);
  22. unset($app_path, $core_path, $package_path, $_SERVER['app_path'], $_SERVER['core_path'], $_SERVER['package_path']);
  23. // Get the start time and memory for use later
  24. defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
  25. defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());
  26. // Boot the app
  27. require_once APPPATH.'bootstrap.php';
  28. // Set test mode
  29. Fuel::$is_test = true;
  30. // Import the TestCase class
  31. import('testcase');