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


PHP SapphireTest::kill_temp_db方法代碼示例

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


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

示例1: run

 public function run($request)
 {
     $db = DB::getConn();
     if (!$db instanceof MySQLDatabase) {
         echo '<h3>This task only appies to MySQL databases. This installation is using a ' . get_class($db) . '</h3>';
         return;
     }
     $oldschema = array();
     $newschema = array();
     $renamed = 0;
     $current = DB::getConn()->currentDatabase();
     foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
         $oldschema[] = $dbtablename;
     }
     DB::getConn()->selectDatabase('tmpdb');
     $test = new SapphireTest();
     $test->create_temp_db();
     foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
         $newschema[] = $dbtablename;
     }
     $test->kill_temp_db();
     DB::getConn()->selectDatabase($current);
     echo "<ul>\n";
     foreach ($newschema as $table) {
         if (in_array(strtolower($table), $oldschema)) {
             echo "<li>renaming {$table}</li>";
             $db->renameTable(strtolower($table), $table);
             $renamed++;
         }
     }
     echo "</ul>\n";
     echo "<p>{$renamed} tables renamed.</p>\n";
 }
開發者ID:helpfulrobot,項目名稱:lekoala-silverstripe-devtoolkit,代碼行數:33,代碼來源:FixTablesCase.php

示例2: artefacts

 /**
  * @return array
  */
 private function artefacts()
 {
     $oldschema = [];
     $newschema = [];
     $current = DB::get_conn()->getSelectedDatabase();
     foreach (DB::table_list() as $lowercase => $dbtablename) {
         $oldschema[$dbtablename] = DB::field_list($dbtablename);
     }
     $test = new SapphireTest();
     $test->create_temp_db();
     foreach (DB::table_list() as $lowercase => $dbtablename) {
         $newschema[$lowercase] = DB::field_list($dbtablename);
     }
     $test->kill_temp_db();
     DB::get_conn()->selectDatabase($current);
     $artefacts = [];
     foreach ($oldschema as $table => $fields) {
         if (!isset($newschema[strtolower($table)])) {
             $artefacts[$table] = $table;
             continue;
         }
         foreach ($fields as $field => $spec) {
             if (!isset($newschema[strtolower($table)][$field])) {
                 $artefacts[$table][$field] = $field;
             }
         }
     }
     return $artefacts;
 }
開發者ID:oddnoc,項目名稱:silverstripe-artefactcleaner,代碼行數:32,代碼來源:ArtefactCleanTask.php

示例3: Artefacts

 function Artefacts()
 {
     $oldschema = array();
     $newschema = array();
     $current = DB::getConn()->currentDatabase();
     foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
         $oldschema[$dbtablename] = DB::getConn()->fieldList($dbtablename);
     }
     DB::getConn()->selectDatabase('tmpdb');
     $test = new SapphireTest();
     $test->create_temp_db();
     foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
         $newschema[$lowercase] = DB::getConn()->fieldList($dbtablename);
     }
     $test->kill_temp_db();
     DB::getConn()->selectDatabase($current);
     $artefacts = array();
     foreach ($oldschema as $table => $fields) {
         if (!isset($newschema[strtolower($table)])) {
             $artefacts[$table] = $table;
             continue;
         }
         foreach ($fields as $field => $spec) {
             if (!isset($newschema[strtolower($table)][$field])) {
                 $artefacts[$table][$field] = $field;
             }
         }
     }
     return $artefacts;
 }
開發者ID:alapini,項目名稱:silverstripe-dbplumber,代碼行數:30,代碼來源:DBP_Database.php

示例4: tearDown

 function tearDown()
 {
     SapphireTest::kill_temp_db();
     DB::set_alternative_database_name(null);
 }
開發者ID:Raiser,項目名稱:Praktikum,代碼行數:5,代碼來源:TestRunner.php

示例5: tearDown

 public function tearDown()
 {
     SapphireTest::kill_temp_db();
 }
開發者ID:javabrett,項目名稱:silverstripe-framework,代碼行數:4,代碼來源:TestRunner.php


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