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


PHP CDbTestCase::setUpBeforeClass方法代碼示例

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


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

示例1: setUpBeforeClass

 /**
  * Loads "reference fixtures" defined in {@link referenceFixtures()} and
  * sets up some special environment variables before proceeding.
  */
 public static function setUpBeforeClass()
 {
     if (!YII_UNIT_TESTING) {
         throw new CException('YII_UNIT_TESTING must be set to true');
     }
     Yii::app()->cache->flush();
     self::setUpAppEnvironment();
     // Load "reference fixtures", needed for reference, which do not need
     // to be reloaded after every single test method:
     $testClass = get_called_class();
     if (X2_TEST_DEBUG_LEVEL > 0) {
         /**/
         println($testClass);
     }
     $refFix = call_user_func("{$testClass}::referenceFixtures");
     $fm = Yii::app()->getComponent('fixture');
     self::$_referenceFixtureRows = array();
     self::$_referenceFixtureRecords = array();
     if (is_array($refFix)) {
         Yii::import('application.components.X2Settings.*');
         $fm->load($refFix);
         if (self::$loadFixtures || self::$loadFixturesForClassOnly) {
             foreach ($refFix as $alias => $table) {
                 $tableName = is_array($table) ? $table[0] : $table;
                 self::$_referenceFixtureRows[$alias] = $fm->getRows($alias);
                 if (strpos($tableName, ':') !== 0) {
                     foreach (self::$_referenceFixtureRows[$alias] as $rowAlias => $row) {
                         $model = CActiveRecord::model($tableName);
                         $key = $model->getTableSchema()->primaryKey;
                         if (is_string($key)) {
                             $pk = $row[$key];
                         } else {
                             foreach ($key as $k) {
                                 $pk[$k] = $row[$k];
                             }
                         }
                         self::$_referenceFixtureRecords[$alias][$rowAlias] = $model->findByPk($pk);
                     }
                 }
             }
         }
     }
     self::setUpAppEnvironment2();
     parent::setUpBeforeClass();
 }
開發者ID:shuvro35,項目名稱:X2CRM,代碼行數:49,代碼來源:X2DbTestCase.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     Yii::app()->db->createCommand()->createTable('split_element_test', array('id' => 'pk', 'title' => 'string NOT NULL', 'eye_id' => 'int(10) unsigned NOT NULL', ' CONSTRAINT `split_eye_id_fk` FOREIGN KEY (`eye_id`) REFERENCES `eye` (`id`)'));
     parent::setUpBeforeClass();
 }
開發者ID:code-4-england,項目名稱:OpenEyes,代碼行數:5,代碼來源:SplitEventTypeElementTest.php


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