From 7718d473c4e17aef89129c90d96c7eca60799d09 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 9 Nov 2014 21:52:10 -0500 Subject: [PATCH] Remove singularization on schema class names. Using camelize() does the transformation we want without also singularizing the name. This makes user input more transparent and fixes issues around plugin schemas with plural names. Refs #4993 --- lib/Cake/Console/Command/SchemaShell.php | 2 +- .../Test/Case/Console/Command/SchemaShellTest.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index d367aad9016..e60d8e734b0 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -89,7 +89,7 @@ public function startup() { $name = $plugin; } } - $name = Inflector::classify($name); + $name = Inflector::camelize($name); $this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin')); } diff --git a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php index 6256e04c53b..793d8daf878 100644 --- a/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php +++ b/lib/Cake/Test/Case/Console/Command/SchemaShellTest.php @@ -617,19 +617,19 @@ public function testName() { $this->Shell->params = array( 'plugin' => 'TestPlugin', 'connection' => 'test', - 'name' => 'custom_name', + 'name' => 'custom_names', 'force' => false, 'overwrite' => true, ); $this->Shell->startup(); - if (file_exists($this->Shell->Schema->path . DS . 'custom_name.php')) { - unlink($this->Shell->Schema->path . DS . 'custom_name.php'); + if (file_exists($this->Shell->Schema->path . DS . 'custom_names.php')) { + unlink($this->Shell->Schema->path . DS . 'custom_names.php'); } $this->Shell->generate(); - $contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_name.php'); - $this->assertRegExp('/class CustomNameSchema/', $contents); - unlink($this->Shell->Schema->path . DS . 'custom_name.php'); + $contents = file_get_contents($this->Shell->Schema->path . DS . 'custom_names.php'); + $this->assertRegExp('/class CustomNamesSchema/', $contents); + unlink($this->Shell->Schema->path . DS . 'custom_names.php'); CakePlugin::unload(); }