Removing $name from controller, model and fixtures.

This commit is contained in:
Juan Basso 2011-01-19 21:15:33 -02:00
parent 09fbaaaab4
commit 40bdcbb44a
6 changed files with 7 additions and 5 deletions

View file

@ -23,7 +23,6 @@ echo "<?php\n";
?>
class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>AppController {
public $name = '<?php echo $controllerName; ?>';
<?php if ($isScaffold): ?>
public $scaffold;
<?php else: ?>

View file

@ -22,7 +22,6 @@
<?php echo '<?php' . "\n"; ?>
/* <?php echo $model; ?> Fixture generated on: <?php echo date('Y-m-d H:i:s') . " : ". time(); ?> */
class <?php echo $model; ?>Fixture extends CakeTestFixture {
public $name = '<?php echo $model; ?>';
<?php if ($table): ?>
public $table = '<?php echo $table; ?>';
<?php endif; ?>

View file

@ -21,7 +21,6 @@
echo "<?php\n"; ?>
class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
public $name = '<?php echo $name; ?>';
<?php if ($useDbConfig != 'default'): ?>
public $useDbConfig = '<?php echo $useDbConfig; ?>';
<?php endif;?>

View file

@ -299,7 +299,6 @@ class FixtureTaskTest extends CakeTestCase {
$result = $this->Task->bake('Article', 'comments');
$this->assertPattern('/class ArticleFixture extends CakeTestFixture/', $result);
$this->assertPattern('/public \$name \= \'Article\';/', $result);
$this->assertPattern('/public \$table \= \'comments\';/', $result);
$this->assertPattern('/public \$fields = array\(/', $result);

View file

@ -668,7 +668,6 @@ class ModelTaskTest extends CakeTestCase {
);
$result = $this->Task->bake('BakeArticle', compact('validate'));
$this->assertPattern('/class BakeArticle extends AppModel \{/', $result);
$this->assertPattern('/\$name \= \'BakeArticle\'/', $result);
$this->assertPattern('/\$validate \= array\(/', $result);
$expected = <<< STRINGEND
array(

View file

@ -50,6 +50,13 @@ class CakeTestFixture {
*
*/
public function __construct() {
if ($this->name === null) {
if (preg_match('/^(.*)Fixture$/', get_class($this), $matches)) {
$this->name = $matches[1];
} else {
$this->name = get_class($this);
}
}
App::import('Model', 'CakeSchema');
$this->Schema = new CakeSchema(array('name' => 'TestSuite', 'connection' => 'test'));
$this->init();