Updating ModelTask to crete files following the new namings

This commit is contained in:
Jose Lorenzo Rodriguez 2011-03-15 22:14:10 -04:00
parent bd2bd4ba22
commit b0a7a109e9
3 changed files with 18 additions and 18 deletions

View file

@ -741,7 +741,7 @@ class ModelTask extends BakeTask {
$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();

View file

@ -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'): ?>
/**

View file

@ -745,7 +745,7 @@ STRINGEND;
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/'));
@ -763,8 +763,8 @@ STRINGEND;
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')
@ -799,7 +799,7 @@ STRINGEND;
$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/'));
@ -814,8 +814,8 @@ STRINGEND;
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')
@ -843,23 +843,23 @@ STRINGEND;
$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/'));
@ -889,19 +889,19 @@ STRINGEND;
$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/'));
@ -939,7 +939,7 @@ STRINGEND;
$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/'));