Skip to content

Commit

Permalink
Fixing AllDatabase tests correctly loading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 10, 2011
1 parent ca776d9 commit a8122a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/Cake/tests/Case/Model/CakeSchemaTest.php
Expand Up @@ -528,6 +528,7 @@ function tearDown() {
parent::tearDown();
@unlink(TMP . 'tests' . DS .'schema.php');
unset($this->Schema);
CakePlugin::unload();
}

/**
Expand Down Expand Up @@ -666,6 +667,7 @@ function testSchemaReadWithPlugins() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');

$Schema = new CakeSchema();
$Schema->plugin = 'TestPlugin';
Expand Down Expand Up @@ -984,6 +986,7 @@ function testSchemaLoadingFromPlugin() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');
$Other = $this->Schema->load(array('name' => 'TestPluginApp', 'plugin' => 'TestPlugin'));
$this->assertEqual($Other->name, 'TestPluginApp');
$this->assertEqual(array_keys($Other->tables), array('test_plugin_acos'));
Expand Down
17 changes: 13 additions & 4 deletions lib/Cake/tests/Case/Model/ConnectionManagerTest.php
Expand Up @@ -25,6 +25,15 @@
*/
class ConnectionManagerTest extends CakeTestCase {


/**
* tearDown method
*
* @return void
*/
public function tearDown() {
CakePlugin::unload();
}
/**
* testEnumConnectionObjects method
*
Expand Down Expand Up @@ -73,7 +82,7 @@ function testGetPluginDataSource() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));

CakePlugin::load('TestPlugin');
$name = 'test_source';
$config = array('datasource' => 'TestPlugin.TestSource');
$connection = ConnectionManager::create($name, $config);
Expand All @@ -95,7 +104,7 @@ function testGetPluginDataSourceAndPluginDriver() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));

CakePlugin::load('TestPlugin');
$name = 'test_plugin_source_and_driver';
$config = array('datasource' => 'TestPlugin.Database/TestDriver');

Expand All @@ -119,7 +128,7 @@ function testGetLocalDataSourceAndPluginDriver() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));

CakePlugin::load('TestPlugin');
$name = 'test_local_source_and_plugin_driver';
$config = array('datasource' => 'TestPlugin.Database/DboDummy');

Expand Down Expand Up @@ -268,7 +277,7 @@ function testConnectionData() {
LIBS . 'tests' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS
)
));

CakePlugin::loadAll();
$expected = array(
'datasource' => 'Test2Source'
);
Expand Down

0 comments on commit a8122a5

Please sign in to comment.