本文整理匯總了PHP中ServiceLocator::SetDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP ServiceLocator::SetDatabase方法的具體用法?PHP ServiceLocator::SetDatabase怎麽用?PHP ServiceLocator::SetDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ServiceLocator
的用法示例。
在下文中一共展示了ServiceLocator::SetDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setup
function setup()
{
$this->_db = new FakeDatabase();
ServiceLocator::SetDatabase($this->_db);
$this->newEncryption = new PasswordEncryption();
$this->oldEncryption = new RetiredPasswordEncryption();
}
示例2: setup
public function setup()
{
Date::_SetNow(Date::Now());
$this->db = new FakeDatabase();
$this->fakeServer = new FakeServer();
$this->fakeEmailService = new FakeEmailService();
$this->fakeConfig = new FakeConfig();
$this->fakeConfig->SetKey(ConfigKeys::DEFAULT_TIMEZONE, 'America/Chicago');
$this->fakeResources = new FakeResources();
$this->fakeUser = $this->fakeServer->UserSession;
$this->fakePluginManager = new FakePluginManager();
$this->fileSystem = new FakeFileSystem();
ServiceLocator::SetDatabase($this->db);
ServiceLocator::SetServer($this->fakeServer);
ServiceLocator::SetEmailService($this->fakeEmailService);
ServiceLocator::SetFileSystem($this->fileSystem);
Configuration::SetInstance($this->fakeConfig);
Resources::SetInstance($this->fakeResources);
PluginManager::SetInstance($this->fakePluginManager);
}