From b5d7f6447f986d0f2905f69ecbab887f60b416fb Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 23 Jul 2010 21:46:06 -0400 Subject: [PATCH] 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 --- cake/console/libs/schema.php | 3 +++ cake/tests/cases/console/libs/schema.test.php | 1 + 2 files changed, 4 insertions(+) diff --git a/cake/console/libs/schema.php b/cake/console/libs/schema.php index 3629f59ad38..889f8545378 100644 --- a/cake/console/libs/schema.php +++ b/cake/console/libs/schema.php @@ -90,6 +90,9 @@ function startup() { } if (!empty($this->params['plugin'])) { $plugin = $this->params['plugin']; + if (empty($name)) { + $name = $plugin; + } } $this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin')); } diff --git a/cake/tests/cases/console/libs/schema.test.php b/cake/tests/cases/console/libs/schema.test.php index 83bd2590693..0f97950d63d 100644 --- a/cake/tests/cases/console/libs/schema.test.php +++ b/cake/tests/cases/console/libs/schema.test.php @@ -368,6 +368,7 @@ function testGenerateWithPlugins() { $file =& new File(TMP . 'tests' . DS . 'schema.php'); $contents = $file->read(); + $this->assertPattern('/class TestPluginSchema/', $contents); $this->assertPattern('/var \$posts/', $contents); $this->assertPattern('/var \$auth_users/', $contents); $this->assertPattern('/var \$authors/', $contents);