コード例 #1
0
 public function prepare()
 {
     if (defined('STAGEHAND_TESTRUNNER_PREPARER_CAKEPREPARER_PREPARECALLEDMARKER')) {
         return;
     }
     define('STAGEHAND_TESTRUNNER_PREPARER_CAKEPREPARER_PREPARECALLEDMARKER', true);
     if (!defined('DISABLE_AUTO_DISPATCH')) {
         define('DISABLE_AUTO_DISPATCH', true);
     }
     if (is_null($this->getCakePHPAppPath())) {
         $cakephpAppPath = $this->environment->getWorkingDirectoryAtStartup();
     } else {
         $cakephpAppPath = $this->getCakePHPAppPath();
     }
     $rootPath = realpath($cakephpAppPath . '/..');
     $appPath = basename(realpath($cakephpAppPath));
     if (is_null($this->getCakePHPCorePath())) {
         $corePath = $rootPath . DIRECTORY_SEPARATOR . 'cake';
     } else {
         $corePath = realpath($this->getCakePHPCorePath());
     }
     if (!defined('TEST_CAKE_CORE_INCLUDE_PATH')) {
         define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
     }
     ob_start();
     require_once $corePath . '/console/cake.php';
     ErrorReporting::invokeWith(error_reporting(), function () use($rootPath, $appPath) {
         new TestRunnerShellDispatcher(array('-root', $rootPath, '-app', $appPath));
     });
     ob_end_clean();
     require_once $corePath . '/tests/lib/test_manager.php';
     new \TestManager();
 }
コード例 #2
0
 public function prepare()
 {
     parent::prepare();
     if (is_null($this->getCIUnitPath())) {
         $ciunitPath = $this->environment->getWorkingDirectoryAtStartup();
     } else {
         $ciunitPath = $this->getCIUnitPath();
     }
     /* Removes some superglobals and environment variables to avoid getting invalid
      * URI string by the CIUnit URI object since some cases PDT sets some
      * environment variables for debugging.
      */
     $this->backupVariables();
     ErrorReporting::invokeWith(error_reporting() & ~E_USER_NOTICE & ~E_WARNING, function () use($ciunitPath) {
         require_once $ciunitPath . '/CIUnit.php';
     });
     $this->restoreVariables();
 }