From 40bdcbb44a4f9f59609c21cd7ed337d48d7e22a6 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Wed, 19 Jan 2011 21:15:33 -0200 Subject: [PATCH] Removing $name from controller, model and fixtures. --- cake/console/templates/default/classes/controller.ctp | 1 - cake/console/templates/default/classes/fixture.ctp | 1 - cake/console/templates/default/classes/model.ctp | 1 - cake/tests/cases/console/shells/tasks/fixture.test.php | 1 - cake/tests/cases/console/shells/tasks/model.test.php | 1 - cake/tests/lib/cake_test_fixture.php | 7 +++++++ 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cake/console/templates/default/classes/controller.ctp b/cake/console/templates/default/classes/controller.ctp index 52f968824..0fd02078b 100644 --- a/cake/console/templates/default/classes/controller.ctp +++ b/cake/console/templates/default/classes/controller.ctp @@ -23,7 +23,6 @@ echo " class Controller extends AppController { - public $name = ''; public $scaffold; diff --git a/cake/console/templates/default/classes/fixture.ctp b/cake/console/templates/default/classes/fixture.ctp index bbb727dd6..987392458 100644 --- a/cake/console/templates/default/classes/fixture.ctp +++ b/cake/console/templates/default/classes/fixture.ctp @@ -22,7 +22,6 @@ /* Fixture generated on: */ class Fixture extends CakeTestFixture { - public $name = ''; public $table = ''; diff --git a/cake/console/templates/default/classes/model.ctp b/cake/console/templates/default/classes/model.ctp index ece196dba..e0ffb50de 100644 --- a/cake/console/templates/default/classes/model.ctp +++ b/cake/console/templates/default/classes/model.ctp @@ -21,7 +21,6 @@ echo " class extends AppModel { - public $name = ''; public $useDbConfig = ''; diff --git a/cake/tests/cases/console/shells/tasks/fixture.test.php b/cake/tests/cases/console/shells/tasks/fixture.test.php index 9cdf9a271..febd38ff8 100644 --- a/cake/tests/cases/console/shells/tasks/fixture.test.php +++ b/cake/tests/cases/console/shells/tasks/fixture.test.php @@ -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); diff --git a/cake/tests/cases/console/shells/tasks/model.test.php b/cake/tests/cases/console/shells/tasks/model.test.php index 98ad033cd..0927dd981 100644 --- a/cake/tests/cases/console/shells/tasks/model.test.php +++ b/cake/tests/cases/console/shells/tasks/model.test.php @@ -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( diff --git a/cake/tests/lib/cake_test_fixture.php b/cake/tests/lib/cake_test_fixture.php index ec56d09ec..f107ffa3f 100644 --- a/cake/tests/lib/cake_test_fixture.php +++ b/cake/tests/lib/cake_test_fixture.php @@ -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();