diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php index fabdd61db..c90805658 100644 --- a/cake/libs/model/schema.php +++ b/cake/libs/model/schema.php @@ -24,9 +24,7 @@ * @lastmodified $Date$ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ -if (!class_exists('connectionmanager')) { - uses('model' . DS . 'connection_manager'); -} +App::import('Model', 'ConnectionManager'); /** * Base Class for Schema management * @@ -82,7 +80,7 @@ class CakeSchema extends Object { } 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'])) { diff --git a/cake/tests/cases/libs/model/schema.test.php b/cake/tests/cases/libs/model/schema.test.php index aed8a2c68..9db8376bf 100644 --- a/cake/tests/cases/libs/model/schema.test.php +++ b/cake/tests/cases/libs/model/schema.test.php @@ -168,6 +168,16 @@ class CakeSchemaTest extends CakeTestCase { $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() { $read = $this->Schema->read(array('connection'=>'test_suite', 'name'=>'TestApp', 'models'=>array('SchemaPost', 'SchemaComment', 'SchemaTag')));