mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
asserting that under_scored names result in valid ClassNames
This commit is contained in:
parent
bed5453be0
commit
5190b9f2c9
2 changed files with 30 additions and 0 deletions
|
@ -96,6 +96,7 @@ class SchemaShell extends AppShell {
|
||||||
$name = $plugin;
|
$name = $plugin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$name = Inflector::classify($name);
|
||||||
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
|
$this->Schema = new CakeSchema(compact('name', 'path', 'file', 'connection', 'plugin'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -498,6 +498,35 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
CakePlugin::unload();
|
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.
|
* test that using Plugin.name with write.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue