本文整理汇总了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);
}