Skip to content
Permalink
Browse files

Adding tests for SchemaShell::generate() with plugins, testing that p…

…lugin schema files do not include non plugin models.
  • Loading branch information...
markstory committed Oct 9, 2009
1 parent ace784a commit c5ec87e57769faf5101f19a14e1de3818342bebc
Showing with 31 additions and 1 deletion.
  1. +31 −1 cake/tests/cases/console/libs/schema.test.php
@@ -116,7 +116,7 @@ class SchemaShellTestSchema extends CakeSchema {
*/
class SchemaShellTest extends CakeTestCase {
var $fixtures = array('core.article', 'core.user');
var $fixtures = array('core.article', 'core.user', 'core.post', 'core.auth_user');
/**
* startTest method
*
@@ -330,6 +330,36 @@ function testGenerateOverwrite() {
unlink(TMP . 'schema.php');
}
/**
* test that generate() can read plugin dirs and generate schema files for the models
* in a plugin.
*
* @return void
**/
function testGenerateWithPlugins() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
$this->Shell->params = array(
'plugin' => 'TestPlugin',
'connection' => 'test_suite'
);
$this->Shell->startup();
$this->Shell->Schema->path = TMP . 'tests' . DS;
$this->Shell->generate();
$file =& new File(TMP . 'tests' . DS . 'schema.php');
$contents = $file->read();
$this->assertPattern('/var \$posts/', $contents);
$this->assertPattern('/var \$auth_users/', $contents);
$this->assertNoPattern('/var \$users/', $contents);
$this->assertNoPattern('/var \$articles/', $contents);
$file->delete();
App::build();
}
/**
* Test schema run create with no table args.
*

0 comments on commit c5ec87e

Please sign in to comment.
You can’t perform that action at this time.