Skip to content

Commit

Permalink
Updating ModelTask to crete files following the new namings
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 16, 2011
1 parent bd2bd4b commit b0a7a10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/ModelTask.php
Expand Up @@ -741,7 +741,7 @@ public function bake($name, $data = array()) {
$out = $this->Template->generate('classes', 'model');

$path = $this->getPath();
$filename = $path . Inflector::underscore($name) . '.php';
$filename = $path . $name . '.php';
$this->out("\nBaking model class for $name...", 1, Shell::QUIET);
$this->createFile($filename, $out);
ClassRegistry::flush();
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/templates/default/classes/test.ctp
Expand Up @@ -20,7 +20,7 @@
echo "<?php\n";
echo "/* ". $className ." Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n";
?>
App::import('<?php echo $type; ?>', '<?php echo $plugin . $className;?>');
App::uses('<?php echo $fullClassName; ?>', '<?php echo $plugin . $type;?>');

<?php if ($mock and strtolower($type) == 'controller'): ?>
/**
Expand Down
32 changes: 16 additions & 16 deletions lib/Cake/tests/cases/console/shells/tasks/model.test.php
Expand Up @@ -745,7 +745,7 @@ public function testBakeRelations() {
public function testBakeWithPlugin() {
$this->Task->plugin = 'controllerTest';

$path = APP . 'plugins' . DS . 'controller_test' . DS . 'models' . DS . 'bake_article.php';
$path = APP . 'plugins' . DS . 'controller_test' . DS . 'models' . DS . 'BakeArticle.php';
$this->Task->expects($this->once())->method('createFile')
->with($path, new PHPUnit_Framework_Constraint_PCREMatch('/BakeArticle extends ControllerTestAppModel/'));

Expand All @@ -763,8 +763,8 @@ public function testBakeWithPlugin() {
public function testExecuteWithNamedModel() {
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->args = array('bake_article');
$filename = '/my/path/bake_article.php';
$this->Task->args = array('BakeArticle');
$filename = '/my/path/BakeArticle.php';

$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
$this->Task->expects($this->once())->method('createFile')
Expand Down Expand Up @@ -799,7 +799,7 @@ public function testExecuteWithNamedModelVariations($name) {
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));

$this->Task->args = array($name);
$filename = '/my/path/bake_article.php';
$filename = '/my/path/BakeArticle.php';

$this->Task->expects($this->at(0))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle extends AppModel/'));
Expand All @@ -814,8 +814,8 @@ public function testExecuteWithNamedModelVariations($name) {
public function testExecuteWithNamedModelHasManyCreated() {
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->args = array('bake_article');
$filename = '/my/path/bake_article.php';
$this->Task->args = array('BakeArticle');
$filename = '/my/path/BakeArticle.php';

$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(1));
$this->Task->expects($this->at(0))->method('createFile')
Expand Down Expand Up @@ -843,23 +843,23 @@ public function testExecuteIntoAll() {
$this->Task->Fixture->expects($this->exactly(5))->method('bake');
$this->Task->Test->expects($this->exactly(5))->method('bake');

$filename = '/my/path/bake_article.php';
$filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->at(1))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));

$filename = '/my/path/bake_articles_bake_tag.php';
$filename = '/my/path/BakeArticlesBakeTag.php';
$this->Task->expects($this->at(2))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/'));

$filename = '/my/path/bake_comment.php';
$filename = '/my/path/BakeComment.php';
$this->Task->expects($this->at(3))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/'));

$filename = '/my/path/bake_tag.php';
$filename = '/my/path/BakeTag.php';
$this->Task->expects($this->at(4))
->method('createFile')->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeTag/'));

$filename = '/my/path/category_thread.php';
$filename = '/my/path/CategoryThread.php';
$this->Task->expects($this->at(5))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/'));

Expand Down Expand Up @@ -889,19 +889,19 @@ function testSkipTablesAndAll() {
$this->Task->Fixture->expects($this->exactly(4))->method('bake');
$this->Task->Test->expects($this->exactly(4))->method('bake');

$filename = '/my/path/bake_article.php';
$filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->at(1))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));

$filename = '/my/path/bake_articles_bake_tag.php';
$filename = '/my/path/BakeArticlesBakeTag.php';
$this->Task->expects($this->at(2))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticlesBakeTag/'));

$filename = '/my/path/bake_comment.php';
$filename = '/my/path/BakeComment.php';
$this->Task->expects($this->at(3))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeComment/'));

$filename = '/my/path/category_thread.php';
$filename = '/my/path/CategoryThread.php';
$this->Task->expects($this->at(4))->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class CategoryThread/'));

Expand Down Expand Up @@ -939,7 +939,7 @@ public function testExecuteIntoInteractive() {
$this->Task->Test->expects($this->once())->method('bake');
$this->Task->Fixture->expects($this->once())->method('bake');

$filename = '/my/path/bake_article.php';
$filename = '/my/path/BakeArticle.php';

$this->Task->expects($this->once())->method('createFile')
->with($filename, new PHPUnit_Framework_Constraint_PCREMatch('/class BakeArticle/'));
Expand Down

0 comments on commit b0a7a10

Please sign in to comment.