2009-09-24 20:23:24 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Connection Manager tests
|
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* PHP 5
|
2009-09-24 20:23:24 +00:00
|
|
|
*
|
2013-02-08 11:59:49 +00:00
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2009-09-24 20:23:24 +00:00
|
|
|
*
|
2010-10-03 16:31:21 +00:00
|
|
|
* Licensed under The MIT License
|
2013-02-08 12:22:51 +00:00
|
|
|
* For full copyright and license information, please see the LICENSE.txt
|
2010-10-03 16:31:21 +00:00
|
|
|
* Redistributions of files must retain the above copyright notice
|
2009-09-24 20:23:24 +00:00
|
|
|
*
|
2013-02-08 11:59:49 +00:00
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2012-04-27 02:49:18 +00:00
|
|
|
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Test.Case.Model
|
2009-09-24 20:23:24 +00:00
|
|
|
* @since CakePHP(tm) v 1.2.0.5550
|
2013-05-30 22:11:14 +00:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
2009-09-24 20:23:24 +00:00
|
|
|
*/
|
2013-05-30 22:11:14 +00:00
|
|
|
|
2010-12-09 05:55:24 +00:00
|
|
|
App::uses('ConnectionManager', 'Model');
|
2009-09-24 20:23:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ConnectionManagerTest
|
|
|
|
*
|
2011-07-26 06:16:14 +00:00
|
|
|
* @package Cake.Test.Case.Model
|
2009-09-24 20:23:24 +00:00
|
|
|
*/
|
|
|
|
class ConnectionManagerTest extends CakeTestCase {
|
|
|
|
|
2011-05-10 04:40:15 +00:00
|
|
|
/**
|
|
|
|
* tearDown method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function tearDown() {
|
2011-09-03 00:14:51 +00:00
|
|
|
parent::tearDown();
|
2011-05-10 04:40:15 +00:00
|
|
|
CakePlugin::unload();
|
|
|
|
}
|
2011-12-06 20:52:48 +00:00
|
|
|
|
2009-09-24 20:23:24 +00:00
|
|
|
/**
|
|
|
|
* testEnumConnectionObjects method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testEnumConnectionObjects() {
|
2009-09-24 20:23:24 +00:00
|
|
|
$sources = ConnectionManager::enumConnectionObjects();
|
|
|
|
$this->assertTrue(count($sources) >= 1);
|
|
|
|
|
2010-09-20 02:58:30 +00:00
|
|
|
$connections = array('default', 'test', 'test');
|
2009-09-24 20:23:24 +00:00
|
|
|
$this->assertTrue(count(array_intersect(array_keys($sources), $connections)) >= 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testGetDataSource method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetDataSource() {
|
2011-05-27 06:43:35 +00:00
|
|
|
App::build(array(
|
|
|
|
'Model/Datasource' => array(
|
|
|
|
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
|
|
|
$name = 'test_get_datasource';
|
|
|
|
$config = array('datasource' => 'Test2Source');
|
|
|
|
|
2013-01-23 12:45:50 +00:00
|
|
|
ConnectionManager::create($name, $config);
|
2009-09-24 20:23:24 +00:00
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2010-06-05 04:17:38 +00:00
|
|
|
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));
|
2009-09-24 20:23:24 +00:00
|
|
|
|
2011-05-27 06:43:35 +00:00
|
|
|
$source = ConnectionManager::getDataSource('test_get_datasource');
|
2009-09-24 20:23:24 +00:00
|
|
|
$this->assertTrue(is_object($source));
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('test_get_datasource');
|
2011-01-13 01:08:34 +00:00
|
|
|
}
|
2009-09-24 20:23:24 +00:00
|
|
|
|
2011-01-13 01:08:34 +00:00
|
|
|
/**
|
|
|
|
* testGetDataSourceException() method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @expectedException MissingDatasourceConfigException
|
|
|
|
*/
|
|
|
|
public function testGetDataSourceException() {
|
|
|
|
ConnectionManager::getDataSource('non_existent_source');
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
|
|
|
|
2009-09-25 02:56:02 +00:00
|
|
|
/**
|
|
|
|
* testGetPluginDataSource method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetPluginDataSource() {
|
2009-09-25 02:56:02 +00:00
|
|
|
App::build(array(
|
2012-02-18 12:31:29 +00:00
|
|
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
2011-09-03 00:14:51 +00:00
|
|
|
), App::RESET);
|
2011-05-10 04:40:15 +00:00
|
|
|
CakePlugin::load('TestPlugin');
|
2009-09-25 02:56:02 +00:00
|
|
|
$name = 'test_source';
|
|
|
|
$config = array('datasource' => 'TestPlugin.TestSource');
|
|
|
|
$connection = ConnectionManager::create($name, $config);
|
|
|
|
|
|
|
|
$this->assertTrue(class_exists('TestSource'));
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($connection->configKeyName, $name);
|
|
|
|
$this->assertEquals($connection->config, $config);
|
2009-09-25 02:56:02 +00:00
|
|
|
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop($name);
|
2009-09-25 02:56:02 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 03:35:16 +00:00
|
|
|
/**
|
|
|
|
* testGetPluginDataSourceAndPluginDriver method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetPluginDataSourceAndPluginDriver() {
|
2010-02-17 03:35:16 +00:00
|
|
|
App::build(array(
|
2012-02-18 12:31:29 +00:00
|
|
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
2011-09-03 00:14:51 +00:00
|
|
|
), App::RESET);
|
2011-05-10 04:40:15 +00:00
|
|
|
CakePlugin::load('TestPlugin');
|
2010-02-17 03:35:16 +00:00
|
|
|
$name = 'test_plugin_source_and_driver';
|
2011-01-06 02:45:17 +00:00
|
|
|
$config = array('datasource' => 'TestPlugin.Database/TestDriver');
|
2010-02-17 03:35:16 +00:00
|
|
|
|
|
|
|
$connection = ConnectionManager::create($name, $config);
|
|
|
|
|
|
|
|
$this->assertTrue(class_exists('TestSource'));
|
|
|
|
$this->assertTrue(class_exists('TestDriver'));
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($connection->configKeyName, $name);
|
|
|
|
$this->assertEquals($connection->config, $config);
|
2010-02-17 03:35:16 +00:00
|
|
|
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop($name);
|
2010-02-17 03:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testGetLocalDataSourceAndPluginDriver method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetLocalDataSourceAndPluginDriver() {
|
2010-02-17 03:35:16 +00:00
|
|
|
App::build(array(
|
2012-02-18 12:31:29 +00:00
|
|
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
2010-02-17 03:35:16 +00:00
|
|
|
));
|
2011-05-10 04:40:15 +00:00
|
|
|
CakePlugin::load('TestPlugin');
|
2010-02-17 03:35:16 +00:00
|
|
|
$name = 'test_local_source_and_plugin_driver';
|
2011-01-06 02:45:17 +00:00
|
|
|
$config = array('datasource' => 'TestPlugin.Database/DboDummy');
|
2010-02-17 03:35:16 +00:00
|
|
|
|
|
|
|
$connection = ConnectionManager::create($name, $config);
|
|
|
|
|
|
|
|
$this->assertTrue(class_exists('DboSource'));
|
|
|
|
$this->assertTrue(class_exists('DboDummy'));
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($connection->configKeyName, $name);
|
2010-02-17 03:35:16 +00:00
|
|
|
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop($name);
|
2010-02-17 03:35:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testGetPluginDataSourceAndLocalDriver method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetPluginDataSourceAndLocalDriver() {
|
2010-02-17 03:35:16 +00:00
|
|
|
App::build(array(
|
2012-02-18 12:31:29 +00:00
|
|
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
2011-03-22 05:16:51 +00:00
|
|
|
'Model/Datasource/Database' => array(
|
2011-04-17 10:35:21 +00:00
|
|
|
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Database' . DS
|
2011-03-22 05:16:51 +00:00
|
|
|
)
|
2010-02-17 03:35:16 +00:00
|
|
|
));
|
|
|
|
|
|
|
|
$name = 'test_plugin_source_and_local_driver';
|
2011-01-06 02:45:17 +00:00
|
|
|
$config = array('datasource' => 'Database/TestLocalDriver');
|
2010-02-17 03:35:16 +00:00
|
|
|
|
|
|
|
$connection = ConnectionManager::create($name, $config);
|
|
|
|
|
|
|
|
$this->assertTrue(class_exists('TestSource'));
|
|
|
|
$this->assertTrue(class_exists('TestLocalDriver'));
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($connection->configKeyName, $name);
|
|
|
|
$this->assertEquals($connection->config, $config);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop($name);
|
2010-02-17 03:35:16 +00:00
|
|
|
}
|
|
|
|
|
2009-09-24 20:23:24 +00:00
|
|
|
/**
|
|
|
|
* testSourceList method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testSourceList() {
|
2011-05-27 06:58:38 +00:00
|
|
|
ConnectionManager::getDataSource('test');
|
2009-09-24 20:23:24 +00:00
|
|
|
$sources = ConnectionManager::sourceList();
|
|
|
|
$this->assertTrue(count($sources) >= 1);
|
2011-05-27 06:43:35 +00:00
|
|
|
$this->assertTrue(in_array('test', array_keys($sources)));
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testGetSourceName method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testGetSourceName() {
|
2011-05-27 06:43:35 +00:00
|
|
|
$source = ConnectionManager::getDataSource('test');
|
2009-09-24 20:23:24 +00:00
|
|
|
$result = ConnectionManager::getSourceName($source);
|
|
|
|
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals('test', $result);
|
2009-09-25 03:48:52 +00:00
|
|
|
|
2010-06-05 04:17:38 +00:00
|
|
|
$source = new StdClass();
|
2009-09-25 03:48:52 +00:00
|
|
|
$result = ConnectionManager::getSourceName($source);
|
2011-05-27 06:43:35 +00:00
|
|
|
$this->assertNull($result);
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testLoadDataSource method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testLoadDataSource() {
|
2009-09-24 20:23:24 +00:00
|
|
|
$connections = array(
|
2012-03-19 01:20:17 +00:00
|
|
|
array('classname' => 'Mysql', 'filename' => 'Mysql', 'package' => 'Database'),
|
|
|
|
array('classname' => 'Postgres', 'filename' => 'Postgres', 'package' => 'Database'),
|
2011-01-06 04:39:11 +00:00
|
|
|
array('classname' => 'Sqlite', 'filename' => 'Sqlite', 'package' => 'Database'),
|
2009-09-24 20:23:24 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($connections as $connection) {
|
|
|
|
$exists = class_exists($connection['classname']);
|
|
|
|
$loaded = ConnectionManager::loadDataSource($connection);
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($loaded, !$exists, "Failed loading the {$connection['classname']} datasource");
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
2011-01-13 01:08:34 +00:00
|
|
|
}
|
2009-09-24 20:23:24 +00:00
|
|
|
|
2011-01-13 01:08:34 +00:00
|
|
|
/**
|
|
|
|
* testLoadDataSourceException() method
|
|
|
|
*
|
|
|
|
* @return void
|
2011-10-15 18:06:31 +00:00
|
|
|
* @expectedException MissingDatasourceException
|
2011-01-13 01:08:34 +00:00
|
|
|
*/
|
|
|
|
public function testLoadDataSourceException() {
|
2009-09-24 20:23:24 +00:00
|
|
|
$connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
|
2013-01-23 12:45:50 +00:00
|
|
|
ConnectionManager::loadDataSource($connection);
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* testCreateDataSource method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testCreateDataSourceWithIntegrationTests() {
|
2009-09-24 20:23:24 +00:00
|
|
|
$name = 'test_created_connection';
|
|
|
|
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2010-06-05 04:17:38 +00:00
|
|
|
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));
|
2009-09-24 20:23:24 +00:00
|
|
|
|
2011-05-27 06:43:35 +00:00
|
|
|
$source = ConnectionManager::getDataSource('test');
|
2009-09-24 20:23:24 +00:00
|
|
|
$this->assertTrue(is_object($source));
|
|
|
|
|
|
|
|
$config = $source->config;
|
|
|
|
$connection = ConnectionManager::create($name, $config);
|
|
|
|
|
|
|
|
$this->assertTrue(is_object($connection));
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($name, $connection->configKeyName);
|
|
|
|
$this->assertEquals($name, ConnectionManager::getSourceName($connection));
|
2009-09-24 20:23:24 +00:00
|
|
|
|
|
|
|
$source = ConnectionManager::create(null, array());
|
2012-03-23 06:37:12 +00:00
|
|
|
$this->assertEquals(null, $source);
|
2009-09-24 20:23:24 +00:00
|
|
|
|
|
|
|
$source = ConnectionManager::create('another_test', array());
|
2012-03-23 06:37:12 +00:00
|
|
|
$this->assertEquals(null, $source);
|
2009-09-24 20:23:24 +00:00
|
|
|
|
|
|
|
$config = array('classname' => 'DboMysql', 'filename' => 'dbo' . DS . 'dbo_mysql');
|
|
|
|
$source = ConnectionManager::create(null, $config);
|
2012-03-23 06:37:12 +00:00
|
|
|
$this->assertEquals(null, $source);
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|
2010-06-21 02:53:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* testConnectionData method
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2011-05-30 20:02:32 +00:00
|
|
|
public function testConnectionData() {
|
2010-06-21 02:53:54 +00:00
|
|
|
App::build(array(
|
2012-02-18 12:31:29 +00:00
|
|
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
2011-03-22 05:16:51 +00:00
|
|
|
'Model/Datasource' => array(
|
2011-04-17 10:35:21 +00:00
|
|
|
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
|
2011-03-22 05:16:51 +00:00
|
|
|
)
|
2011-09-03 00:14:51 +00:00
|
|
|
), App::RESET);
|
2012-02-17 03:59:24 +00:00
|
|
|
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
|
2010-06-21 02:53:54 +00:00
|
|
|
$expected = array(
|
2011-12-19 13:18:28 +00:00
|
|
|
'datasource' => 'Test2Source'
|
2010-06-21 02:53:54 +00:00
|
|
|
);
|
|
|
|
|
2011-01-06 02:45:17 +00:00
|
|
|
ConnectionManager::create('connection1', array('datasource' => 'Test2Source'));
|
2010-06-21 02:53:54 +00:00
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection1']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection1');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
|
|
|
ConnectionManager::create('connection2', array('datasource' => 'Test2Source'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection2']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection2');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
2011-01-06 02:45:17 +00:00
|
|
|
ConnectionManager::create('connection3', array('datasource' => 'TestPlugin.TestSource'));
|
2010-06-21 02:53:54 +00:00
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-01-06 02:45:17 +00:00
|
|
|
$expected['datasource'] = 'TestPlugin.TestSource';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection3']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection3');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
|
|
|
ConnectionManager::create('connection4', array('datasource' => 'TestPlugin.TestSource'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection4']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection4');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
2011-01-06 02:45:17 +00:00
|
|
|
ConnectionManager::create('connection5', array('datasource' => 'Test2OtherSource'));
|
2010-06-21 02:53:54 +00:00
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-01-06 02:45:17 +00:00
|
|
|
$expected['datasource'] = 'Test2OtherSource';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection5']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection5');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
|
|
|
ConnectionManager::create('connection6', array('datasource' => 'Test2OtherSource'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection6']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection6');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
2011-01-06 02:45:17 +00:00
|
|
|
ConnectionManager::create('connection7', array('datasource' => 'TestPlugin.TestOtherSource'));
|
2010-06-21 02:53:54 +00:00
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-01-06 02:45:17 +00:00
|
|
|
$expected['datasource'] = 'TestPlugin.TestOtherSource';
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection7']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection7');
|
2010-06-21 02:53:54 +00:00
|
|
|
|
|
|
|
ConnectionManager::create('connection8', array('datasource' => 'TestPlugin.TestOtherSource'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals($expected, $connections['connection8']);
|
2011-05-27 06:43:35 +00:00
|
|
|
ConnectionManager::drop('connection8');
|
2010-06-21 02:53:54 +00:00
|
|
|
}
|
2011-04-17 03:27:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests that a connection configuration can be deleted in runtime
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testDrop() {
|
|
|
|
App::build(array(
|
|
|
|
'Model/Datasource' => array(
|
2011-04-17 10:35:21 +00:00
|
|
|
CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
|
2011-04-17 03:27:05 +00:00
|
|
|
)
|
|
|
|
));
|
|
|
|
ConnectionManager::create('droppable', array('datasource' => 'Test2Source'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
2011-11-16 00:07:56 +00:00
|
|
|
$this->assertEquals(array('datasource' => 'Test2Source'), $connections['droppable']);
|
2011-04-17 03:27:05 +00:00
|
|
|
|
|
|
|
$this->assertTrue(ConnectionManager::drop('droppable'));
|
|
|
|
$connections = ConnectionManager::enumConnectionObjects();
|
|
|
|
$this->assertFalse(isset($connections['droppable']));
|
|
|
|
}
|
2009-09-24 20:23:24 +00:00
|
|
|
}
|