Skip to content
Permalink
Browse files

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
  • Loading branch information...
markstory committed Nov 10, 2014
1 parent 9ce3d89 commit 7718d473c4e17aef89129c90d96c7eca60799d09
@@ -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'));
}
@@ -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();
}

0 comments on commit 7718d47

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