Applying patch from 'asavoy'. Changing schema shell so that schema files generated for plugins have the classname of PluginSchema instead of AppSchema. Tests updated. Fixes #922

This commit is contained in:
mark_story 2010-07-23 21:46:06 -04:00
parent a965056af7
commit b5d7f6447f
2 changed files with 4 additions and 0 deletions

View file

@ -90,6 +90,9 @@ class SchemaShell extends Shell {
} }
if (!empty($this->params['plugin'])) { if (!empty($this->params['plugin'])) {
$plugin = $this->params['plugin']; $plugin = $this->params['plugin'];
if (empty($name)) {
$name = $plugin;
}
} }
$this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin')); $this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
} }

View file

@ -368,6 +368,7 @@ class SchemaShellTest extends CakeTestCase {
$file =& new File(TMP . 'tests' . DS . 'schema.php'); $file =& new File(TMP . 'tests' . DS . 'schema.php');
$contents = $file->read(); $contents = $file->read();
$this->assertPattern('/class TestPluginSchema/', $contents);
$this->assertPattern('/var \$posts/', $contents); $this->assertPattern('/var \$posts/', $contents);
$this->assertPattern('/var \$auth_users/', $contents); $this->assertPattern('/var \$auth_users/', $contents);
$this->assertPattern('/var \$authors/', $contents); $this->assertPattern('/var \$authors/', $contents);