本文整理汇总了PHP中TestEnv::setupDefaultData方法的典型用法代码示例。如果您正苦于以下问题:PHP TestEnv::setupDefaultData方法的具体用法?PHP TestEnv::setupDefaultData怎么用?PHP TestEnv::setupDefaultData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv
的用法示例。
在下文中一共展示了TestEnv::setupDefaultData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupEnv
/**
* A method to set up the environment based on
* the layer the test/s is/are in.
*
* @param string $layer The layer the test/s is/are in.
* @param bool $keepDatabase True if the dabase needs to be preserved.
*/
function setupEnv($layer, $keepDatabase = false)
{
if (is_null($layer)) {
$layer = $_GET['layer'];
}
$type = $GLOBALS['_MAX']['TEST']['test_type'];
$envType = $GLOBALS['_MAX']['TEST'][$type . '_layers'][$layer][1];
// Ensure the config file is fresh
TestEnv::restoreConfig();
// Tear down the database, if needed
if (!$keepDatabase) {
TestEnv::teardownDB();
}
TestEnv::backupPluginSchemaFiles();
// Setup the database, if needed
if ($envType == DB_NO_TABLES) {
TestEnv::setupDB($keepDatabase);
} elseif ($envType == DB_WITH_TABLES) {
TestEnv::setupDB($keepDatabase);
TestEnv::setupCoreTables();
} elseif ($envType == DB_WITH_DATA) {
TestEnv::setupDB($keepDatabase);
TestEnv::setupCoreTables();
TestEnv::setupDefaultData();
}
// Store the layer in a global variable, so the environment
// can be completely re-built during tests using the
// TestEnv::restoreEnv() method
$GLOBALS['_MAX']['TEST']['layerEnv'] = $layer;
}