Skip to content
Permalink
Browse files

Fix short echo CS in bake class templates

  • Loading branch information...
bcrowe committed Aug 23, 2014
1 parent 8e28b7c commit 70fbaadde33893c075ff54d0790488b483372d72
@@ -59,7 +59,7 @@ $allAssociations = array_merge(
$<?= $singularName?> = $this-><?= $currentModelName ?>->get($id, [
'contain' => [<?= $stringifyList($allAssociations) ?>]
]);
$this->set('<?= $singularName; ?>', $<?= $singularName; ?>);
$this->set('<?= $singularName ?>', $<?= $singularName ?>);
}

<?php $compact = ["'" . $singularName . "'"]; ?>
@@ -72,10 +72,10 @@ $allAssociations = array_merge(
$<?= $singularName ?> = $this-><?= $currentModelName ?>->newEntity($this->request->data);
if ($this->request->is('post')) {
if ($this-><?= $currentModelName; ?>->save($<?= $singularName ?>)) {
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been saved.');
$this->Flash->success('The <?= strtolower($singularHumanName) ?> has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.');
$this->Flash->error('The <?= strtolower($singularHumanName) ?> could not be saved. Please, try again.');
}
}
<?php
@@ -105,10 +105,10 @@ $allAssociations = array_merge(
if ($this->request->is(['patch', 'post', 'put'])) {
$<?= $singularName ?> = $this-><?= $currentModelName ?>->patchEntity($<?= $singularName ?>, $this->request->data);
if ($this-><?= $currentModelName; ?>->save($<?= $singularName ?>)) {
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been saved.');
$this->Flash->success('The <?= strtolower($singularHumanName) ?> has been saved.');
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be saved. Please, try again.');
$this->Flash->error('The <?= strtolower($singularHumanName) ?> could not be saved. Please, try again.');
}
}
<?php
@@ -134,9 +134,9 @@ $allAssociations = array_merge(
$<?= $singularName ?> = $this-><?= $currentModelName ?>->get($id);
$this->request->allowMethod('post', 'delete');
if ($this-><?= $currentModelName; ?>->delete($<?= $singularName ?>)) {
$this->Flash->success('The <?= strtolower($singularHumanName); ?> has been deleted.');
$this->Flash->success('The <?= strtolower($singularHumanName) ?> has been deleted.');
} else {
$this->Flash->error('The <?= strtolower($singularHumanName); ?> could not be deleted. Please, try again.');
$this->Flash->error('The <?= strtolower($singularHumanName) ?> could not be deleted. Please, try again.');
}
return $this->redirect(['action' => 'index']);
}
@@ -24,7 +24,7 @@ namespace <?= $namespace ?>\Controller<?= $prefix ?>;
use <?= $namespace ?>\Controller\AppController;

/**
* <?= $name; ?> Controller
* <?= $name ?> Controller
*
<?php
$defaultModel = $name;
@@ -36,7 +36,7 @@ if (!empty($components)) {
}
?>
*/
class <?= $name; ?>Controller extends AppController {
class <?= $name ?>Controller extends AppController {

<?php
@@ -18,23 +18,23 @@
*/
?>
<?= '<?php' . "\n"; ?>
namespace <?= $namespace; ?>\Test\Fixture;
namespace <?= $namespace ?>\Test\Fixture;

use Cake\TestSuite\Fixture\TestFixture;

/**
* <?= $name; ?>Fixture
* <?= $name ?>Fixture
*
*/
class <?= $name; ?>Fixture extends TestFixture {
class <?= $name ?>Fixture extends TestFixture {

<?php if ($table): ?>
/**
* Table name
*
* @var string
*/
public $table = '<?= $table; ?>';
public $table = '<?= $table ?>';

<?php endif; ?>
<?php if ($import): ?>
@@ -43,7 +43,7 @@ class <?= $name; ?>Fixture extends TestFixture {
*
* @var array
*/
public $import = <?= $import; ?>;
public $import = <?= $import ?>;

<?php endif; ?>
<?php if ($schema): ?>
@@ -52,7 +52,7 @@ class <?= $name; ?>Fixture extends TestFixture {
*
* @var array
*/
public $fields = <?= $schema; ?>;
public $fields = <?= $schema ?>;

<?php endif; ?>
<?php if ($records): ?>
@@ -61,7 +61,7 @@ class <?= $name; ?>Fixture extends TestFixture {
*
* @var array
*/
public $records = <?= $records; ?>;
public $records = <?= $records ?>;

<?php endif; ?>
}
@@ -31,12 +31,12 @@ use Cake\TestSuite\TestCase;
<?php endif; ?>

/**
* <?= $fullClassName; ?> Test Case
* <?= $fullClassName ?> Test Case
*/
<?php if ($isController): ?>
class <?= $className; ?>Test extends ControllerTestCase {
class <?= $className ?>Test extends ControllerTestCase {
<?php else: ?>
class <?= $className; ?>Test extends TestCase {
class <?= $className ?>Test extends TestCase {
<?php endif; ?>

<?php if (!empty($fixtures)): ?>
@@ -58,9 +58,9 @@ class <?= $className; ?>Test extends TestCase {
*/
public function setUp() {
parent::setUp();
<?= $preConstruct ? "\t\t" . $preConstruct : ''; ?>
$this-><?= $subject . ' = ' . $construction; ?>
<?= $postConstruct ? "\t\t" . $postConstruct : ''; ?>
<?= $preConstruct ? "\t\t" . $preConstruct : '' ?>
$this-><?= $subject . ' = ' . $construction ?>
<?= $postConstruct ? "\t\t" . $postConstruct : '' ?>
}

/**
@@ -69,20 +69,20 @@ class <?= $className; ?>Test extends TestCase {
* @return void
*/
public function tearDown() {
unset($this-><?= $subject; ?>);
unset($this-><?= $subject ?>);

parent::tearDown();
}

<?php endif; ?>
<?php foreach ($methods as $method): ?>
/**
* test<?= Inflector::camelize($method); ?> method
* test<?= Inflector::camelize($method) ?> method
*
* @return void
*/
public function test<?= Inflector::camelize($method); ?>() {
$this->markTestIncomplete('test<?= Inflector::camelize($method); ?> not implemented.');
public function test<?= Inflector::camelize($method) ?>() {
$this->markTestIncomplete('test<?= Inflector::camelize($method) ?> not implemented.');
}

<?php endforeach; ?>

0 comments on commit 70fbaad

Please sign in to comment.
You can’t perform that action at this time.