Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

asserting that under_scored names result in valid ClassNames

  • Loading branch information...
commit 5190b9f2c91f5ac2adf36ce529c1be53ff89e8f2 1 parent bed5453
Mark S. dereuromark authored
1  lib/Cake/Console/Command/SchemaShell.php
View
@@ -96,6 +96,7 @@ public function startup() {
$name = $plugin;
}
}
+ $name = Inflector::classify($name);
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
}
29 lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
View
@@ -499,6 +499,35 @@ public function testPluginParam() {
}
/**
+ * test that underscored names also result in CamelCased class names
+ *
+ * @return void
+ */
+ public function testName() {
+ App::build(array(
+ 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
+ ));
+ CakePlugin::load('TestPlugin');
+ $this->Shell->params = array(
+ 'plugin' => 'TestPlugin',
+ 'connection' => 'test',
+ 'name' => 'custom_name',
+ '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');
+ }
+ $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');
+ CakePlugin::unload();
+ }
+
+/**
* test that using Plugin.name with write.
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.