當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SapphireTest::set_is_running_test方法代碼示例

本文整理匯總了PHP中SapphireTest::set_is_running_test方法的典型用法代碼示例。如果您正苦於以下問題:PHP SapphireTest::set_is_running_test方法的具體用法?PHP SapphireTest::set_is_running_test怎麽用?PHP SapphireTest::set_is_running_test使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SapphireTest的用法示例。


在下文中一共展示了SapphireTest::set_is_running_test方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

    }
    foreach ($args as $arg) {
        if (strpos($arg, '=') == false) {
            $_GET['args'][] = $arg;
        } else {
            $newItems = array();
            parse_str(substr($arg, 0, 2) == '--' ? substr($arg, 2) : $arg, $newItems);
            $_GET = array_merge($_GET, $newItems);
        }
    }
    $_REQUEST = array_merge($_REQUEST, $_GET);
}
// Connect to database
require_once $frameworkPath . '/core/Core.php';
require_once $frameworkPath . '/tests/FakeController.php';
global $databaseConfig;
DB::connect($databaseConfig);
// Now set a fake REQUEST_URI
$_SERVER['REQUEST_URI'] = BASE_URL . '/dev';
// Fake a session
$_SESSION = null;
// Prepare manifest autoloader
$controller = new FakeController();
// Get test manifest
TestRunner::use_test_manifest();
SapphireTest::set_is_running_test(true);
// Remove the error handler so that PHPUnit can add its own
restore_error_handler();
if (!isset($_GET['flush']) || !$_GET['flush']) {
    Debug::message("WARNING: Manifest not flushed. " . "Add flush=1 as an argument to discover new classes or files.\n", false);
}
開發者ID:fanggu,項目名稱:loveyourwater_ss_v3.1.6,代碼行數:31,代碼來源:bootstrap.php

示例2: endTestSession

 /**
  * Cleans up the test session state by restoring the normal database connect (for the rest of this request, if any)
  * and removes the {@link self::$test_state_file} so that future requests don't use this test state.
  *
  * Can be extended by implementing either onBeforeEndTestSession() or onAfterEndTestSession().
  *
  * This should implement itself cleanly in case it is called twice (e.g. don't throw errors when the state file
  * doesn't exist anymore because it's already been cleaned up etc.) This is because during behat test runs where
  * a queueing system (e.g. silverstripe-resque) is used, the behat module may call this first, and then the forked
  * worker will call it as well - but there is only one state file that is created.
  */
 public function endTestSession()
 {
     $this->extend('onBeforeEndTestSession');
     if (SapphireTest::using_temp_db()) {
         $state = $this->getState();
         $dbConn = DB::getConn();
         $dbExists = $dbConn->databaseExists($state->database);
         if ($dbExists) {
             // Clean up temp database
             $dbConn->dropDatabase();
             file_put_contents('php://stdout', "Deleted temp database: {$state->database}" . PHP_EOL);
         }
         // End test session mode
         $this->resetDatabaseName();
         SapphireTest::set_is_running_test(false);
     }
     $this->removeStateFile();
     $this->extend('onAfterEndTestSession');
 }
開發者ID:jeffreyguo,項目名稱:silverstripe-testsession,代碼行數:30,代碼來源:TestSessionEnvironment.php

示例3: endTestSession

 /**
  * Cleans up the test session state by restoring the normal database connect (for the rest of this request, if any)
  * and removes the {@link self::$test_state_file} so that future requests don't use this test state.
  *
  * Can be extended by implementing either onBeforeEndTestSession() or onAfterEndTestSession().
  *
  * This should implement itself cleanly in case it is called twice (e.g. don't throw errors when the state file
  * doesn't exist anymore because it's already been cleaned up etc.) This is because during behat test runs where
  * a queueing system (e.g. silverstripe-resque) is used, the behat module may call this first, and then the forked
  * worker will call it as well - but there is only one state file that is created.
  */
 public function endTestSession()
 {
     $this->extend('onBeforeEndTestSession');
     if (SapphireTest::using_temp_db()) {
         $this->resetDatabaseName();
         SapphireTest::set_is_running_test(false);
     }
     $this->removeStateFile();
     $this->extend('onAfterEndTestSession');
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-testsession,代碼行數:21,代碼來源:TestSessionEnvironment.php


注:本文中的SapphireTest::set_is_running_test方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。