fixes #3969, schema name for app dirs with special characters

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6518 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-03-08 16:30:44 +00:00
parent 24ea731e7f
commit c1ea4dff88
2 changed files with 12 additions and 4 deletions

View file

@ -24,9 +24,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
if (!class_exists('connectionmanager')) { App::import('Model', 'ConnectionManager');
uses('model' . DS . 'connection_manager');
}
/** /**
* Base Class for Schema management * Base Class for Schema management
* *
@ -82,7 +80,7 @@ class CakeSchema extends Object {
} }
if ($this->name === 'Cake') { if ($this->name === 'Cake') {
$this->name = Inflector::camelize(Configure::read('App.dir')); $this->name = Inflector::camelize(Inflector::slug(Configure::read('App.dir')));
} }
if (empty($options['path'])) { if (empty($options['path'])) {

View file

@ -168,6 +168,16 @@ class CakeSchemaTest extends CakeTestCase {
$this->Schema = new TestAppSchema(); $this->Schema = new TestAppSchema();
} }
function testSchemaName() {
$Schema = new CakeSchema();
$this->assertEqual($Schema->name, 'App');
Configure::write('App.dir', 'Some.name.with.dots');
$Schema = new CakeSchema();
$this->assertEqual($Schema->name, 'SomeNameWithDots');
Configure::write('App.dir', 'app');
}
function testSchemaRead() { function testSchemaRead() {
$read = $this->Schema->read(array('connection'=>'test_suite', 'name'=>'TestApp', 'models'=>array('SchemaPost', 'SchemaComment', 'SchemaTag'))); $read = $this->Schema->read(array('connection'=>'test_suite', 'name'=>'TestApp', 'models'=>array('SchemaPost', 'SchemaComment', 'SchemaTag')));