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


PHP CakeTestFixture::drop方法代碼示例

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


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

示例1: _setupTable

 /**
  * Runs the drop and create commands on the fixtures if necessary.
  *
  * @param CakeTestFixture $fixture the fixture object to create
  * @param DataSource $db the datasource instance to use
  * @param boolean $drop whether drop the fixture if it is already created or not
  * @return void
  */
 protected function _setupTable($fixture, $db = null, $drop = true)
 {
     if (!$db) {
         if (!empty($fixture->useDbConfig)) {
             $db = ClassRegistry::getDataSource($fixture->useDbConfig);
         } else {
             $db = $this->_db;
         }
     }
     if (!empty($fixture->created) && in_array($db->configKeyName, $fixture->created)) {
         return;
     }
     $sources = $db->listSources();
     $table = $db->config['prefix'] . $fixture->table;
     if ($drop && in_array($table, $sources)) {
         $fixture->drop($db);
         $fixture->create($db);
     } elseif (!in_array($table, $sources)) {
         $fixture->create($db);
     }
 }
開發者ID:pkdevbox,項目名稱:app.director,代碼行數:29,代碼來源:CakeFixtureManager.php

示例2: getFixtures

 /**
  * @brief get the fixtures
  *
  * This method will first get any required fixtures from events for plugins
  * that need to load up fixtures regardless. Any fixtures you have specifically
  * loaded will then be setup. After that any fixtures for the model that is being
  * tested will be loaded and all dependencies that are found. Finally any
  * replacements that you need doing are done.
  *
  * replacements:
  *	you can replace the default fixture that is loaded automatically with
  *	your own. too do this you just pass the array with (oldfixture => newfixture).
  *	this is used when you need to load up your own data instead of some core
  *	data for example.
  *
  * @access public
  *
  * @param string $model the model that is being loaded
  * @param bool $load true will insert data, false will only load up fixtures
  *
  * @return void
  */
 public function getFixtures($model = null, $load = false)
 {
     $this->fixturesFromEvents();
     $this->getRequestsedFixtures();
     if ($model) {
         $this->fixturesForModel($model);
     }
     $this->getRequestsedFixtures('replace');
     $CakeTestFixture = new CakeTestFixture();
     $CakeTestFixture->drop($this->__testObject->db);
     $this->loadFixtures($this->__fixturesToLoad, $load);
 }
開發者ID:nani8124,項目名稱:infinitas,代碼行數:34,代碼來源:AppTest.php

示例3: _setupTable

 /**
  * Runs the drop and create commands on the fixtures if necessary
  *
  * @param CakeTestFixture $fixture the fixture object to create
  * @param DataSource $db the datasource instance to use
  * @param boolean $drop whether drop the fixture if it is already created or not
  * @return void
  */
 protected function _setupTable($fixture, $db = null, $drop = true)
 {
     if (!$db) {
         $db = $this->_db;
     }
     if (!empty($fixture->created) && $fixture->created == $db->configKeyName) {
         return;
     }
     $cacheSources = $db->cacheSources;
     $db->cacheSources = false;
     $sources = $db->listSources();
     $db->cacheSources = $cacheSources;
     $table = $db->config['prefix'] . $fixture->table;
     if ($drop && in_array($table, $sources)) {
         $fixture->drop($db);
         $fixture->create($db);
         $fixture->created = $db->configKeyName;
     } elseif (!in_array($table, $sources)) {
         $fixture->create($db);
         $fixture->created = $db->configKeyName;
     }
 }
開發者ID:Nervie,項目名稱:Beta,代碼行數:30,代碼來源:CakeFixtureManager.php

示例4: _setupTable

 /**
  * Runs the drop and create commands on the fixtures if necessary.
  *
  * @param CakeTestFixture $fixture the fixture object to create
  * @param DataSource $db the datasource instance to use
  * @param bool $drop whether drop the fixture if it is already created or not
  * @return void
  */
 protected function _setupTable($fixture, $db = null, $drop = true)
 {
     if (!$db) {
         if (!empty($fixture->useDbConfig)) {
             $db = ConnectionManager::getDataSource($fixture->useDbConfig);
         } else {
             $db = $this->_db;
         }
     }
     if (!empty($fixture->created) && in_array($db->configKeyName, $fixture->created)) {
         return;
     }
     $sources = (array) $db->listSources();
     $table = $db->config['prefix'] . $fixture->table;
     $exists = in_array($table, $sources);
     if ($drop && $exists) {
         $fixture->drop($db);
         $fixture->create($db);
     } elseif (!$exists) {
         $fixture->create($db);
     } else {
         $fixture->created[] = $db->configKeyName;
     }
 }
開發者ID:agashish,項目名稱:test_new,代碼行數:32,代碼來源:CakeFixtureManager.php

示例5: drop

 /**
  * Drops the table from the test datasource
  *
  * @param DboSource $db
  * @return void
  */
 public function drop($db)
 {
     unset(static::$_tableHashes[$this->table]);
     return parent::drop($db);
 }
開發者ID:theplankmeister,項目名稱:cakephp-fixturize,代碼行數:11,代碼來源:TableCopyTestFixture.php


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