From 5ed9e5d691d058cc1bbbe3811c2de8da3c63e493 Mon Sep 17 00:00:00 2001 From: euromark Date: Mon, 19 Aug 2013 21:51:04 +0200 Subject: [PATCH 1/6] sync and correct generic css --- app/webroot/css/cake.generic.css | 3 +++ lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/webroot/css/cake.generic.css b/app/webroot/css/cake.generic.css index 16ab34521..9bdf5307a 100644 --- a/app/webroot/css/cake.generic.css +++ b/app/webroot/css/cake.generic.css @@ -109,6 +109,9 @@ p { padding: 6px 10px; text-align: right; } +#header a, #footer a { + color: #fff; +} /** containers **/ div.form, diff --git a/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css b/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css index f83a52508..9bdf5307a 100644 --- a/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css +++ b/lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css @@ -13,7 +13,6 @@ * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://cakephp.org CakePHP(tm) Project * @package app.webroot.css - * @since CakePHP(tm) * @license http://www.opensource.org/licenses/mit-license.php MIT License */ @@ -110,6 +109,9 @@ p { padding: 6px 10px; text-align: right; } +#header a, #footer a { + color: #fff; +} /** containers **/ div.form, From 036954b52d7bbbbcd6986fdb65669f6dfc804245 Mon Sep 17 00:00:00 2001 From: euromark Date: Tue, 20 Aug 2013 20:27:06 +0200 Subject: [PATCH 2/6] remove duplicate newlines according to CS --- lib/Cake/Test/Case/Controller/ComponentTest.php | 1 - lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php | 1 - lib/Cake/Test/Case/Controller/ControllerTest.php | 1 - lib/Cake/Test/Case/Error/ExceptionRendererTest.php | 1 - lib/Cake/Test/Case/Model/models.php | 1 - lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php | 2 -- lib/Cake/Test/Case/View/ViewTest.php | 1 - 7 files changed, 8 deletions(-) diff --git a/lib/Cake/Test/Case/Controller/ComponentTest.php b/lib/Cake/Test/Case/Controller/ComponentTest.php index 8e5fca054..531adccfb 100644 --- a/lib/Cake/Test/Case/Controller/ComponentTest.php +++ b/lib/Cake/Test/Case/Controller/ComponentTest.php @@ -193,7 +193,6 @@ class SomethingWithEmailComponent extends Component { public $components = array('Email'); } - /** * ComponentTest class * diff --git a/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php b/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php index fcba798c8..7085d52b6 100644 --- a/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php @@ -119,7 +119,6 @@ class MergePostsController extends MergeVarPluginAppController { public $uses = array(); } - /** * Test Case for Controller Merging of Vars. * diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index 7e9aad5ce..d37f8b359 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -50,7 +50,6 @@ class ControllerTestAppController extends Controller { public $components = array('Cookie'); } - /** * ControllerPost class * diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php index 40c357053..cf2a0631e 100644 --- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php +++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php @@ -131,7 +131,6 @@ class MyCustomExceptionRenderer extends ExceptionRenderer { class MissingWidgetThingException extends NotFoundException { } - /** * ExceptionRendererTest class * diff --git a/lib/Cake/Test/Case/Model/models.php b/lib/Cake/Test/Case/Model/models.php index 1f6c8799b..5290e42ad 100644 --- a/lib/Cake/Test/Case/Model/models.php +++ b/lib/Cake/Test/Case/Model/models.php @@ -2517,7 +2517,6 @@ class MyCategoriesMyProduct extends CakeTestModel { public $name = 'MyCategoriesMyProduct'; } - /** * NumberTree class * diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php index 23cca570d..186f64bef 100644 --- a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php +++ b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php @@ -111,7 +111,6 @@ class StringsTestFixture extends CakeTestFixture { ); } - /** * CakeTestFixtureImportFixture class * @@ -175,7 +174,6 @@ class FixturePrefixTest extends Model { public $useDbConfig = 'test'; } - /** * Test case for CakeTestFixture * diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index fb20bc1b9..0a05a32b8 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -219,7 +219,6 @@ class TestAfterHelper extends Helper { } - /** * ViewTest class * From 24123e23740c69885f3ec6afe9989c55ed2935d7 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 21 Aug 2013 13:09:47 -0400 Subject: [PATCH 3/6] Add test for postLink with escape false + confirm option. Closes #4008 --- .../Test/Case/View/Helper/FormHelperTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 4df698b73..eb4d100b3 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -6992,6 +6992,23 @@ class FormHelperTest extends CakeTestCase { 'Delete', '/a' )); + + $result = $this->Form->postLink( + '', + array('controller' => 'items', 'action' => 'delete', 10), + array('class' => 'btn btn-danger', 'escape' => false), + 'Confirm thing' + ); + $this->assertTags($result, array( + 'form' => array( + 'method' => 'post', 'action' => '/items/delete/10', + 'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/', 'style' => 'display:none;' + ), + 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), + '/form', + 'a' => array('class' => 'btn btn-danger', 'href' => '#', 'onclick' => 'preg:/if \(confirm\(\'Confirm thing\'\)\) \{ document\.post_\w+\.submit\(\); \} event\.returnValue = false; return false;/'), + '/a' + )); } /** From faa2cbd3c3fc1bbf83064727847789123110b8e3 Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 21 Aug 2013 13:18:44 -0400 Subject: [PATCH 4/6] Remove session.auto_start configuration. It now fails in PHP >= 5.5.2 . Also it never did anything in earlier versions as the session would have already been started if auto_start was true. Fixes #4010 --- lib/Cake/Model/Datasource/CakeSession.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index 038613ba6..c9f7f08b8 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -557,7 +557,6 @@ class CakeSession { 'session.serialize_handler' => 'php', 'session.use_cookies' => 1, 'session.cookie_path' => self::$path, - 'session.auto_start' => 0, 'session.save_path' => TMP . 'sessions', 'session.save_handler' => 'files' ) @@ -568,7 +567,6 @@ class CakeSession { 'ini' => array( 'session.use_trans_sid' => 0, 'url_rewriter.tags' => '', - 'session.auto_start' => 0, 'session.use_cookies' => 1, 'session.cookie_path' => self::$path, 'session.save_handler' => 'user', @@ -584,7 +582,6 @@ class CakeSession { 'ini' => array( 'session.use_trans_sid' => 0, 'url_rewriter.tags' => '', - 'session.auto_start' => 0, 'session.use_cookies' => 1, 'session.cookie_path' => self::$path, 'session.save_handler' => 'user', From 703d9881e97df0b6996e5c689972b670fd88fe3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renan=20Gon=C3=A7alves?= Date: Fri, 9 Aug 2013 23:06:15 +0200 Subject: [PATCH 5/6] Adding files to be compared against bake generated files, fixing bake templates in the meantime. Writing assertContains() or assertRegExp for generated code is a pain and making the test cover most part of it is very difficult. Things like: ``` } else { } ``` Are very easy to happen (which was the case) and was not being covered by the test. --- .../default/actions/controller_actions.ctp | 35 ++++--- .../Templates/default/classes/controller.ctp | 2 +- .../Command/Task/ControllerTaskTest.php | 79 +++------------- .../Controller/ActionsUsingSessions.ctp | 91 +++++++++++++++++++ .../Controller/ActionsWithNoSessions.ctp | 84 +++++++++++++++++ .../bake_compare/Controller/NoActions.ctp | 27 ++++++ .../Controller/NoHelpersOrComponents.ctp | 18 ++++ .../Test/bake_compare/Controller/Scaffold.ctp | 16 ++++ 8 files changed, 266 insertions(+), 86 deletions(-) create mode 100644 lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp create mode 100644 lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp create mode 100644 lib/Cake/Test/bake_compare/Controller/NoActions.ctp create mode 100644 lib/Cake/Test/bake_compare/Controller/NoHelpersOrComponents.ctp create mode 100644 lib/Cake/Test/bake_compare/Controller/Scaffold.ctp diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp index ecc3363ad..3cae12115 100644 --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp @@ -55,15 +55,14 @@ $this->->create(); if ($this->->save($this->request->data)) { - $this->Session->setFlash(__('The has been saved')); + $this->Session->setFlash(__('The has been saved.')); return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The could not be saved. Please, try again.')); - return $this->flash(__(' saved.'), array('action' => 'index')); + return $this->flash(__('The has been saved.'), array('action' => 'index')); } - - $this->Session->setFlash(__('The could not be saved. Please, try again.')); - } request->is('post') || $this->request->is('put')) { if ($this->->save($this->request->data)) { - $this->Session->setFlash(__('The has been saved')); + $this->Session->setFlash(__('The has been saved.')); return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The could not be saved. Please, try again.')); return $this->flash(__('The has been saved.'), array('action' => 'index')); } - - $this->Session->setFlash(__('The could not be saved. Please, try again.')); - } else { $options = array('conditions' => array('.' . $this->->primaryKey => $id)); $this->request->data = $this->->find('first', $options); @@ -142,16 +140,15 @@ $this->request->onlyAllow('post', 'delete'); if ($this->->delete()) { - $this->Session->setFlash(__(' deleted')); - return $this->redirect(array('action' => 'index')); - - return $this->flash(__(' deleted'), array('action' => 'index')); - + $this->Session->setFlash(__('The has been deleted.')); + } else { + $this->Session->setFlash(__('The could not be deleted. Please, try again.')); } - - $this->Session->setFlash(__(' was not deleted')); - - return $this->flash(__(' was not deleted'), array('action' => 'index')); - return $this->redirect(array('action' => 'index')); + + return $this->flash(__('The has been deleted.'), array('action' => 'index')); + } else { + return $this->flash(__('The could not be deleted. Please, try again.'), array('action' => 'index')); + } + } diff --git a/lib/Cake/Console/Templates/default/classes/controller.ctp b/lib/Cake/Console/Templates/default/classes/controller.ctp index dcdfd1063..ac07d8f8f 100644 --- a/lib/Cake/Console/Templates/default/classes/controller.ctp +++ b/lib/Cake/Console/Templates/default/classes/controller.ctp @@ -76,7 +76,7 @@ class Controller extends App echo ");\n\n"; endif; - echo trim($actions) . "\n"; + echo trim($actions); endif; ?> } diff --git a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php index fcf86204b..f363e878b 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php +++ b/lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php @@ -282,29 +282,17 @@ class ControllerTaskTest extends CakeTestCase { $components = array('Acl', 'Auth'); $this->Task->expects($this->any())->method('createFile')->will($this->returnValue(true)); - $result = $this->Task->bake('Articles', '--actions--', $helpers, $components); - $this->assertContains(' * @property Article $Article', $result); - $this->assertContains(' * @property AclComponent $Acl', $result); - $this->assertContains(' * @property AuthComponent $Auth', $result); - $this->assertContains(' * @property PaginatorComponent $Paginator', $result); - $this->assertContains('class ArticlesController extends AppController', $result); - $this->assertContains("public \$components = array('Acl', 'Auth', 'Paginator')", $result); - $this->assertContains("public \$helpers = array('Js', 'Time')", $result); - $this->assertContains("--actions--", $result); + $result = $this->Task->bake('Articles', null, $helpers, $components); + $expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'NoActions.ctp'); + $this->assertTextEquals($expected, $result); + + $result = $this->Task->bake('Articles', null, array(), array()); + $expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'NoHelpersOrComponents.ctp'); + $this->assertTextEquals($expected, $result); $result = $this->Task->bake('Articles', 'scaffold', $helpers, $components); - $this->assertContains("class ArticlesController extends AppController", $result); - $this->assertContains("public \$scaffold", $result); - $this->assertNotContains('@property', $result); - $this->assertNotContains('helpers', $result); - $this->assertNotContains('components', $result); - - $result = $this->Task->bake('Articles', '--actions--', array(), array()); - $this->assertContains('class ArticlesController extends AppController', $result); - $this->assertSame(substr_count($result, '@property'), 2); - $this->assertContains("public \$components = array('Paginator')", $result); - $this->assertNotContains('helpers', $result); - $this->assertContains('--actions--', $result); + $expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'Scaffold.ctp'); + $this->assertTextEquals($expected, $result); } /** @@ -348,30 +336,10 @@ class ControllerTaskTest extends CakeTestCase { */ public function testBakeActionsUsingSessions() { $result = $this->Task->bakeActions('BakeArticles', null, true); - - $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("\$options = array('conditions' => array('BakeArticle.' . \$this->BakeArticle->primaryKey => \$id));", $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->Session->setFlash(__('The bake article has been saved'));", $result); - - $this->assertContains('function edit($id = null)', $result); - $this->assertContains("\$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));", $result); - - $this->assertContains('function delete($id = null)', $result); - $this->assertContains('if ($this->BakeArticle->delete())', $result); - $this->assertContains("\$this->Session->setFlash(__('Bake article deleted'));", $result); + $expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'ActionsUsingSessions.ctp'); + $this->assertTextEquals($expected, $result); $result = $this->Task->bakeActions('BakeArticles', 'admin_', true); - $this->assertContains('function admin_index() {', $result); $this->assertContains('function admin_add()', $result); $this->assertContains('function admin_view($id = null)', $result); @@ -386,29 +354,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 . 'bake_compare' . DS . 'Controller' . DS . 'ActionsWithNoSessions.ctp'); + $this->assertTextEquals($expected, $result); } /** diff --git a/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp b/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp new file mode 100644 index 000000000..35bed4c8b --- /dev/null +++ b/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp @@ -0,0 +1,91 @@ + +/** + * index method + * + * @return void + */ + public function index() { + $this->BakeArticle->recursive = 0; + $this->set('bakeArticles', $this->Paginator->paginate()); + } + +/** + * view method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function view($id = null) { + if (!$this->BakeArticle->exists($id)) { + throw new NotFoundException(__('Invalid bake article')); + } + $options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id)); + $this->set('bakeArticle', $this->BakeArticle->find('first', $options)); + } + +/** + * add method + * + * @return void + */ + public function add() { + if ($this->request->is('post')) { + $this->BakeArticle->create(); + if ($this->BakeArticle->save($this->request->data)) { + $this->Session->setFlash(__('The bake article has been saved.')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The bake article could not be saved. Please, try again.')); + } + } + $bakeTags = $this->BakeArticle->BakeTag->find('list'); + $this->set(compact('bakeTags')); + } + +/** + * edit method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function edit($id = null) { + if (!$this->BakeArticle->exists($id)) { + throw new NotFoundException(__('Invalid bake article')); + } + if ($this->request->is('post') || $this->request->is('put')) { + if ($this->BakeArticle->save($this->request->data)) { + $this->Session->setFlash(__('The bake article has been saved.')); + return $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The bake article could not be saved. Please, try again.')); + } + } else { + $options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id)); + $this->request->data = $this->BakeArticle->find('first', $options); + } + $bakeTags = $this->BakeArticle->BakeTag->find('list'); + $this->set(compact('bakeTags')); + } + +/** + * delete method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function delete($id = null) { + $this->BakeArticle->id = $id; + if (!$this->BakeArticle->exists()) { + throw new NotFoundException(__('Invalid bake article')); + } + $this->request->onlyAllow('post', 'delete'); + if ($this->BakeArticle->delete()) { + $this->Session->setFlash(__('The bake article has been deleted.')); + } else { + $this->Session->setFlash(__('The bake article could not be deleted. Please, try again.')); + } + return $this->redirect(array('action' => 'index')); + } diff --git a/lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp b/lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp new file mode 100644 index 000000000..61fb80127 --- /dev/null +++ b/lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp @@ -0,0 +1,84 @@ + +/** + * index method + * + * @return void + */ + public function index() { + $this->BakeArticle->recursive = 0; + $this->set('bakeArticles', $this->Paginator->paginate()); + } + +/** + * view method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function view($id = null) { + if (!$this->BakeArticle->exists($id)) { + throw new NotFoundException(__('Invalid bake article')); + } + $options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id)); + $this->set('bakeArticle', $this->BakeArticle->find('first', $options)); + } + +/** + * add method + * + * @return void + */ + public function add() { + if ($this->request->is('post')) { + $this->BakeArticle->create(); + if ($this->BakeArticle->save($this->request->data)) { + return $this->flash(__('The bake article has been saved.'), array('action' => 'index')); + } + } + $bakeTags = $this->BakeArticle->BakeTag->find('list'); + $this->set(compact('bakeTags')); + } + +/** + * edit method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function edit($id = null) { + if (!$this->BakeArticle->exists($id)) { + throw new NotFoundException(__('Invalid bake article')); + } + if ($this->request->is('post') || $this->request->is('put')) { + if ($this->BakeArticle->save($this->request->data)) { + return $this->flash(__('The bake article has been saved.'), array('action' => 'index')); + } + } else { + $options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id)); + $this->request->data = $this->BakeArticle->find('first', $options); + } + $bakeTags = $this->BakeArticle->BakeTag->find('list'); + $this->set(compact('bakeTags')); + } + +/** + * delete method + * + * @throws NotFoundException + * @param string $id + * @return void + */ + public function delete($id = null) { + $this->BakeArticle->id = $id; + if (!$this->BakeArticle->exists()) { + throw new NotFoundException(__('Invalid bake article')); + } + $this->request->onlyAllow('post', 'delete'); + if ($this->BakeArticle->delete()) { + return $this->flash(__('The bake article has been deleted.'), array('action' => 'index')); + } else { + return $this->flash(__('The bake article could not be deleted. Please, try again.'), array('action' => 'index')); + } + } diff --git a/lib/Cake/Test/bake_compare/Controller/NoActions.ctp b/lib/Cake/Test/bake_compare/Controller/NoActions.ctp new file mode 100644 index 000000000..54efe9f9f --- /dev/null +++ b/lib/Cake/Test/bake_compare/Controller/NoActions.ctp @@ -0,0 +1,27 @@ + Date: Thu, 22 Aug 2013 17:54:05 -0400 Subject: [PATCH 6/6] Update docs to reflect the routes that are actually connected. Refs #GH-1413 --- lib/Cake/Config/routes.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/Cake/Config/routes.php b/lib/Cake/Config/routes.php index be918bfc8..1e5140201 100644 --- a/lib/Cake/Config/routes.php +++ b/lib/Cake/Config/routes.php @@ -1,7 +1,5 @@