Skip to content

Commit

Permalink
updating SchemaShell tests to use CakePlugin class
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 12, 2011
1 parent 685b7f8 commit e97b330
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/Cake/tests/Case/Console/Command/SchemaShellTest.php
Expand Up @@ -189,6 +189,7 @@ public function testViewWithPlugins() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');
$this->Shell->args = array('TestPlugin.schema');
$this->Shell->startup();
$this->Shell->expects($this->exactly(2))->method('_stop');
Expand All @@ -201,6 +202,7 @@ public function testViewWithPlugins() {
$this->Shell->view();

App::build();
CakePlugin::unload();
}

/**
Expand Down Expand Up @@ -238,6 +240,7 @@ public function testDumpFileWritingWithPlugins() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');
$this->Shell->args = array('TestPlugin.TestPluginApp');
$this->Shell->params = array(
'connection' => 'test',
Expand All @@ -256,6 +259,7 @@ public function testDumpFileWritingWithPlugins() {

$this->file->delete();
App::build();
CakePlugin::unload();
}

/**
Expand Down Expand Up @@ -334,7 +338,7 @@ public function testGenerateWithPlugins() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true);
App::objects('plugin', null, false);
CakePlugin::load('TestPlugin');

$this->db->cacheSources = false;
$this->Shell->params = array(
Expand All @@ -355,6 +359,7 @@ public function testGenerateWithPlugins() {
$this->assertPattern('/var \$test_plugin_comments/', $contents);
$this->assertNoPattern('/var \$users/', $contents);
$this->assertNoPattern('/var \$articles/', $contents);
CakePlugin::unload();
}

/**
Expand Down Expand Up @@ -447,13 +452,15 @@ public function testPluginParam() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');
$this->Shell->params = array(
'plugin' => 'TestPlugin',
'connection' => 'test'
);
$this->Shell->startup();
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'config' . DS . 'schema';
$expected = LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'TestPlugin' . DS . 'config' . DS . 'schema';
$this->assertEqual($this->Shell->Schema->path, $expected);
CakePlugin::unload();
}

/**
Expand All @@ -465,6 +472,7 @@ public function testPluginDotSyntaxWithCreate() {
App::build(array(
'plugins' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
CakePlugin::load('TestPlugin');
$this->Shell->params = array(
'connection' => 'test'
);
Expand All @@ -479,5 +487,6 @@ public function testPluginDotSyntaxWithCreate() {

$schema = new TestPluginAppSchema();
$db->execute($db->dropSchema($schema, 'test_plugin_acos'));
CakePlugin::unload();
}
}

0 comments on commit e97b330

Please sign in to comment.