本文整理匯總了PHP中ConnectionManager::loadDataSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConnectionManager::loadDataSource方法的具體用法?PHP ConnectionManager::loadDataSource怎麽用?PHP ConnectionManager::loadDataSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ConnectionManager
的用法示例。
在下文中一共展示了ConnectionManager::loadDataSource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testLoadDataSourceException
/**
* testLoadDataSourceException() method
*
* @return void
* @expectedException MissingDatasourceException
*/
public function testLoadDataSourceException()
{
$connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
ConnectionManager::loadDataSource($connection);
}
示例2: testLoadDataSource
/**
* testLoadDataSource method
*
* @access public
* @return void
*/
function testLoadDataSource()
{
$connections = array(array('classname' => 'DboMysql', 'filename' => 'dbo' . DS . 'dbo_mysql'), array('classname' => 'DboMysqli', 'filename' => 'dbo' . DS . 'dbo_mysqli'), array('classname' => 'DboMssql', 'filename' => 'dbo' . DS . 'dbo_mssql'), array('classname' => 'DboOracle', 'filename' => 'dbo' . DS . 'dbo_oracle'));
foreach ($connections as $connection) {
$exists = class_exists($connection['classname']);
$loaded = ConnectionManager::loadDataSource($connection);
$this->assertEqual($loaded, !$exists, "%s Failed loading the {$connection['classname']} datasource");
}
$connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
$this->expectError(new PatternExpectation('/Unable to import DataSource class/i'));
$loaded = ConnectionManager::loadDataSource($connection);
$this->assertEqual($loaded, null);
}