本文整理汇总了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);
}
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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);
}