mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
Removing $name from controller, model and fixtures.
This commit is contained in:
parent
09fbaaaab4
commit
40bdcbb44a
6 changed files with 7 additions and 5 deletions
|
@ -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: ?>
|
||||
|
|
|
@ -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; ?>
|
||||
|
|
|
@ -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;?>
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue