Skip to content
Permalink
Browse files

asserting that under_scored names result in valid ClassNames

  • Loading branch information...
dereuromark committed Aug 8, 2012
1 parent bed5453 commit 5190b9f2c91f5ac2adf36ce529c1be53ff89e8f2
Showing with 30 additions and 0 deletions.
  1. +1 −0 lib/Cake/Console/Command/SchemaShell.php
  2. +29 −0 lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
@@ -96,6 +96,7 @@ public function startup() {
$name = $plugin;
}
}
$name = Inflector::classify($name);
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
}
@@ -498,6 +498,35 @@ public function testPluginParam() {
CakePlugin::unload();
}
/**
* 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.
*

0 comments on commit 5190b9f

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