Created
August 9, 2013 20:29
-
-
Save renan/6196925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp | |
| index e3df021..8f02af2 100644 | |
| --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp | |
| +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp | |
| @@ -55,14 +55,12 @@ | |
| $this-><?php echo $currentModelName; ?>->create(); | |
| if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) { | |
| <?php if ($wannaUseSession): ?> | |
| - $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved')); | |
| + $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.')); | |
| return $this->redirect(array('action' => 'index')); | |
| -<?php else: ?> | |
| - $this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.'), array('action' => 'index')); | |
| -<?php endif; ?> | |
| } else { | |
| -<?php if ($wannaUseSession): ?> | |
| $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.')); | |
| +<?php else: ?> | |
| + $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index')); | |
| <?php endif; ?> | |
| } | |
| } | |
| @@ -100,12 +98,10 @@ | |
| <?php if ($wannaUseSession): ?> | |
| $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved')); | |
| return $this->redirect(array('action' => 'index')); | |
| -<?php else: ?> | |
| - $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index')); | |
| -<?php endif; ?> | |
| } else { | |
| -<?php if ($wannaUseSession): ?> | |
| $this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.')); | |
| +<?php else: ?> | |
| + $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index')); | |
| <?php endif; ?> | |
| } | |
| } else { | |
| @@ -145,15 +141,14 @@ | |
| if ($this-><?php echo $currentModelName; ?>->delete()) { | |
| <?php if ($wannaUseSession): ?> | |
| $this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted')); | |
| - return $this->redirect(array('action' => 'index')); | |
| + } else { | |
| + $this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted')); | |
| + } | |
| + return $this->redirect(array('action' => 'index')); | |
| <?php else: ?> | |
| $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index')); | |
| -<?php endif; ?> | |
| + } else { | |
| + $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'), array('action' => 'index')); | |
| } | |
| -<?php if ($wannaUseSession): ?> | |
| - $this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted')); | |
| -<?php else: ?> | |
| - $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'), array('action' => 'index')); | |
| <?php endif; ?> | |
| - return $this->redirect(array('action' => 'index')); | |
| } | |
| diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php | |
| index fcf8620..d242368 100644 | |
| --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php | |
| +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php | |
| @@ -386,29 +386,8 @@ class ControllerTaskTest extends CakeTestCase { | |
| */ | |
| public function testBakeActionsWithNoSessions() { | |
| $result = $this->Task->bakeActions('BakeArticles', null, false); | |
| - | |
| - $this->assertContains('function index() {', $result); | |
| - $this->assertContains('$this->BakeArticle->recursive = 0;', $result); | |
| - $this->assertContains("\$this->set('bakeArticles', \$this->Paginator->paginate());", $result); | |
| - | |
| - $this->assertContains('function view($id = null)', $result); | |
| - $this->assertContains("throw new NotFoundException(__('Invalid bake article'));", $result); | |
| - $this->assertContains("\$this->set('bakeArticle', \$this->BakeArticle->find('first', \$options));", $result); | |
| - | |
| - $this->assertContains('function add()', $result); | |
| - $this->assertContains("if (\$this->request->is('post'))", $result); | |
| - $this->assertContains('if ($this->BakeArticle->save($this->request->data))', $result); | |
| - | |
| - $this->assertContains("\$this->flash(__('The bake article has been saved.'), array('action' => 'index'))", $result); | |
| - | |
| - $this->assertContains('function edit($id = null)', $result); | |
| - $this->assertContains("\$this->BakeArticle->BakeTag->find('list')", $result); | |
| - $this->assertContains("\$this->set(compact('bakeTags'))", $result); | |
| - | |
| - $this->assertContains('function delete($id = null)', $result); | |
| - $this->assertContains("\$this->request->onlyAllow('post', 'delete')", $result); | |
| - $this->assertContains('if ($this->BakeArticle->delete())', $result); | |
| - $this->assertContains("\$this->flash(__('Bake article deleted'), array('action' => 'index'))", $result); | |
| + $expected = file_get_contents(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'BakeFiles' . DS . 'Controller' . DS . 'BakeActionsWithNoSessions.php'); | |
| + $this->assertEquals($expected, $result); | |
| } | |
| /** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment