本文整理汇总了PHP中RedBeanDatabase::close方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanDatabase::close方法的具体用法?PHP RedBeanDatabase::close怎么用?PHP RedBeanDatabase::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanDatabase
的用法示例。
在下文中一共展示了RedBeanDatabase::close方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
RedBeanDatabase::close();
RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password, true);
if (is_file($this->databaseBackupTestFile)) {
unlink($this->databaseBackupTestFile);
}
}
示例2: tearDownAfterClass
public static function tearDownAfterClass()
{
if (RedBeanDatabase::isFrozen()) {
TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
} else {
TestDatabaseUtil::deleteAllTablesExceptLog();
}
RedBeanModel::forgetAll();
RedBeanDatabase::close();
assert('!RedBeanDatabase::isSetup()');
// Not Coding Standard
GeneralCache::forgetAll();
}
示例3: closeDatabaseConnection
protected static function closeDatabaseConnection()
{
if (RedBeanDatabase::isSetup()) {
RedBeanDatabase::close();
assert('!RedBeanDatabase::isSetup()');
}
}
示例4: handleEndRequest
public function handleEndRequest($event)
{
RedBeanDatabase::close();
exit;
}
示例5: testRun
public function testRun()
{
chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands');
$command = "php zurmocTest.php install {$this->temporaryDatabaseHostname} {$this->temporaryDatabaseName} ";
$command .= "{$this->temporaryDatabaseUsername} {$this->temporaryDatabasePassword} {$this->temporaryDatabasePort} ";
$command .= "{$this->superUserPassword} 'http://sampleHost' 'app/index.php' demodata 1";
if (!IS_WINNT) {
$command .= ' 2>&1';
}
exec($command, $output);
$instanceRoot = INSTANCE_ROOT;
$perInstanceConfigFile = "{$instanceRoot}/protected/config/perInstanceTest.php";
$debugConfigFile = "{$instanceRoot}/protected/config/debugTest.php";
$perInstanceConfiguration = file_get_contents($perInstanceConfigFile);
$debugConfiguration = file_get_contents($debugConfigFile);
//Check if config files is updated.
$this->assertRegExp('/\\$connectionString = \'mysql:host=' . $this->temporaryDatabaseHostname . ';port=' . $this->temporaryDatabasePort . ';dbname=' . $this->temporaryDatabaseName . '\';/', $perInstanceConfiguration);
$this->assertRegExp('/\\$username = \'' . $this->temporaryDatabaseUsername . '\';/', $perInstanceConfiguration);
$this->assertRegExp('/\\$password = \'' . $this->temporaryDatabasePassword . '\';/', $perInstanceConfiguration);
RedBeanDatabase::close();
RedBeanDatabase::setup(Yii::app()->tempDb->connectionString, Yii::app()->tempDb->username, Yii::app()->tempDb->password, true);
$count = R::getRow('select count(*) count from _user');
$this->assertEquals(9, $count['count']);
}
示例6: reconnectToDatabase
protected static function reconnectToDatabase()
{
RedBeanDatabase::close();
RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password);
}
示例7: close
/**
* Closes the database.
*/
public static function close()
{
RedBeanDatabase::close();
}
示例8: tearDownAfterClass
public static function tearDownAfterClass()
{
if (static::$activateDefaultLanguages) {
Yii::app()->languageHelper->deactivateLanguagesForTesting();
}
TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
PermissionsCache::forgetAll();
AllPermissionsOptimizationCache::forgetAll();
RedBeanModel::forgetAll();
RedBeanDatabase::close();
assert('!RedBeanDatabase::isSetup()');
// Not Coding Standard
GeneralCache::forgetAll();
BeanModelCache::forgetAll();
}
示例9: tearDown
public function tearDown()
{
RedBeanDatabase::close();
RedBeanDatabase::setup(Yii::app()->db->connectionString, Yii::app()->db->username, Yii::app()->db->password, true);
}
示例10: testAllActions
public function testAllActions()
{
//Ensure that installed = false
Yii::app()->setApplicationInstalled(false);
//Check index action.
$this->runControllerWithNoExceptionsAndGetContent('install/default');
$this->runControllerWithNoExceptionsAndGetContent('install/default/index');
//Check welcome action.
$this->runControllerWithNoExceptionsAndGetContent('install/default/welcome');
//Check checkSystem action.
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$serverSoftware = $_SERVER['SERVER_SOFTWARE'];
}
$_SERVER['SERVER_SOFTWARE'] = 'Apache';
$this->runControllerWithNoExceptionsAndGetContent('install/default/checkSystem');
//Check settings action.
$this->runControllerWithNoExceptionsAndGetContent('install/default/settings');
//Check validateSettings action.
//First validation will fail, and there should be at least validation errors.
$this->setPostArray(array('ajax' => 'install-form', 'InstallSettingsForm' => array('databaseHostname' => '', 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => '', 'databaseUsername' => '', 'databasePassword' => '', 'databasePort' => '', 'superUserPassword' => '', 'memcacheHostname' => '', 'memcachePortNumber' => '', 'memcacheAvailable' => '', 'databaseType' => 'mysql', 'removeExistingData' => '', 'installDemoData' => '')));
$content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
$errors = CJSON::decode($content);
$this->assertGreaterThanOrEqual(5, count($errors));
$postData = array('ajax' => 'install-form', 'InstallSettingsForm' => array('databaseHostname' => $this->databaseHostname, 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => $this->databaseName, 'databaseUsername' => $this->databaseUsername, 'databasePassword' => $this->databasePassword, 'databasePort' => $this->databasePort, 'superUserPassword' => $this->superUserPassword, 'databaseType' => 'mysql', 'removeExistingData' => '1', 'installDemoData' => ''));
if (MEMCACHE_ON) {
$memcacheSettings = array('memcacheHostname' => 'localhost', 'memcachePortNumber' => '11211', 'memcacheAvailable' => '1');
} else {
$memcacheSettings = array('memcacheHostname' => '', 'memcachePortNumber' => '', 'memcacheAvailable' => '0');
}
$postData['InstallSettingsForm'] = array_merge($postData['InstallSettingsForm'], $memcacheSettings);
$this->setPostArray($postData);
$content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
$errors = CJSON::decode($content);
$this->assertEquals(1, count($errors));
$postData['InstallSettingsForm']['hostInfo'] = 'http://www.example.com';
$this->setPostArray($postData);
$content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
$errors = CJSON::decode($content);
$this->assertEquals(0, count($errors));
//Run installation.
$this->setPostArray(array('InstallSettingsForm' => array('databaseHostname' => $this->databaseHostname, 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => $this->databaseName, 'databaseUsername' => $this->databaseUsername, 'databasePassword' => $this->databasePassword, 'databasePort' => $this->databasePort, 'superUserPassword' => $this->superUserPassword, 'memcacheHostname' => 'localhost', 'memcachePortNumber' => '11211', 'memcacheAvailable' => '1', 'databaseType' => 'mysql', 'removeExistingData' => '1', 'installDemoData' => '', 'hostInfo' => 'http://www.example.com')));
//Close db connection(new will be created during installation process).
RedBeanDatabase::close();
$this->runControllerWithExitExceptionAndGetContent('install/default/settings');
$industryFieldData = CustomFieldData::getByName('Industries');
$this->assertGreaterThan('0', count(unserialize($industryFieldData->serializedData)));
//Check installDemoData action.
RedBeanDatabase::close();
DemoDataUtil::unsetLoadedModules();
$this->runControllerWithNoExceptionsAndGetContent('install/default/installDemoData');
$this->assertGreaterThan('0', Account::getAll());
$this->assertGreaterThan('0', Contact::getAll());
//Restore $_SERVER['SERVER_SOFTWARE']
if (isset($serverSoftware)) {
$_SERVER['SERVER_SOFTWARE'] = $serverSoftware;
} else {
unset($_SERVER['SERVER_SOFTWARE']);
}
}