本文整理汇总了PHP中Piwik\Db::destroyDatabaseObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::destroyDatabaseObject方法的具体用法?PHP Db::destroyDatabaseObject怎么用?PHP Db::destroyDatabaseObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Db
的用法示例。
在下文中一共展示了Db::destroyDatabaseObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_constructor_shouldNotEstablishADatabaseConnection
public function test_constructor_shouldNotEstablishADatabaseConnection()
{
Db::destroyDatabaseObject();
$this->assertNotDbConnectionCreated();
$this->createSettingsInstance();
$this->assertNotDbConnectionCreated();
}
示例2: test_SqlMode_IsSet_PDO
/**
* @dataProvider getDbAdapter
*/
public function test_SqlMode_IsSet_PDO($adapter, $expectedClass)
{
Db::destroyDatabaseObject();
Config::getInstance()->database['adapter'] = $adapter;
$db = Db::get();
// make sure test is useful and setting adapter works
$this->assertInstanceOf($expectedClass, $db);
$result = $db->fetchOne('SELECT @@SESSION.sql_mode');
$expected = 'NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER';
$this->assertSame($expected, $result);
}
示例3: test_constructor_shouldEstablishADatabaseConnection_AsSoonAsWeSetAValue
public function test_constructor_shouldEstablishADatabaseConnection_AsSoonAsWeSetAValue()
{
$this->setSuperUser();
Db::destroyDatabaseObject();
$setting = $this->buildUserSetting('testSetting', 'Test Setting');
$settings = $this->createSettingsInstance();
$settings->addSetting($setting);
$this->assertNotDbConnectionCreated();
$setting->setValue('5');
$this->assertDbConnectionCreated();
}
示例4: test_getDbLock_shouldGetLock
public function test_getDbLock_shouldGetLock()
{
$db = Db::get();
$this->assertTrue(Db::getDbLock('MyLock'));
// same session still has lock
$this->assertTrue(Db::getDbLock('MyLock'));
Db::setDatabaseObject(null);
// different session, should not be able to acquire lock
$this->assertFalse(Db::getDbLock('MyLock', 1));
// different session cannot release lock
$this->assertFalse(Db::releaseDbLock('MyLock'));
Db::destroyDatabaseObject();
// release lock again by using previous session
Db::setDatabaseObject($db);
$this->assertTrue(Db::releaseDbLock('MyLock'));
Db::destroyDatabaseObject();
}
示例5: test_process_ShouldNotCreateADatabaseConnectionAtAnyTime
public function test_process_ShouldNotCreateADatabaseConnectionAtAnyTime()
{
$this->setDummyRequests(false);
Queue\Factory::getSettings()->queueEnabled->getValue();
// this will cause a db query but will be cached afterwards
Db::destroyDatabaseObject();
$this->handler->init($this->tracker, $this->requestSet);
$this->assertNotDbConnectionCreated();
$this->handler->onStartTrackRequests($this->tracker, $this->requestSet);
$this->assertNotDbConnectionCreated();
$this->handler->process($this->tracker, $this->requestSet);
$this->assertNotDbConnectionCreated();
$this->handler->onAllRequestsTracked($this->tracker, $this->requestSet);
$this->assertNotDbConnectionCreated();
$this->handler->finish($this->tracker, $this->requestSet);
$this->assertNotDbConnectionCreated();
}
示例6: resetDatabase
private function resetDatabase()
{
Option::clearCache();
Db::destroyDatabaseObject();
}
示例7: setUp
public function setUp()
{
parent::setUp();
Db::destroyDatabaseObject();
$this->settings = $this->createSettingsInstance();
}