From a796b26f13ed71632378019afcc00feaa778fb64 Mon Sep 17 00:00:00 2001 From: euromark Date: Fri, 13 Sep 2013 00:09:31 +0200 Subject: [PATCH] fix renderLayout and update deprecated and outdated code --- .../Templates/default/actions/controller_actions.ctp | 2 +- lib/Cake/Controller/Component/SecurityComponent.php | 2 +- .../Controller/Component/SecurityComponentTest.php | 8 ++++---- lib/Cake/Test/Case/View/ViewTest.php | 10 +++++----- .../bake_compare/Controller/ActionsUsingSessions.ctp | 2 +- .../bake_compare/Controller/ActionsWithNoSessions.ctp | 2 +- .../Test/test_app/Controller/TestsAppsController.php | 2 -- .../test_app/Controller/TestsAppsPostsController.php | 2 -- lib/Cake/Test/test_app/Model/Comment.php | 7 ------- lib/Cake/Test/test_app/Model/PersisterOne.php | 2 -- lib/Cake/Test/test_app/Model/PersisterTwo.php | 2 -- lib/Cake/Test/test_app/Model/Post.php | 2 -- .../TestPlugin/Controller/Component/OtherComponent.php | 2 +- .../Controller/Component/TestPluginComponent.php | 6 +++--- .../Controller/Component/TestPluginOtherComponent.php | 4 ++-- .../Plugin/TestPlugin/Controller/TestsController.php | 2 -- .../Plugin/TestPlugin/View/Elements/translate.ctp | 2 +- .../View/Layouts/Emails/text/plug_default.ctp | 2 +- .../Test/test_app/View/Layouts/Emails/html/default.ctp | 2 +- .../test_app/View/Layouts/Emails/html/japanese.ctp | 2 +- .../Test/test_app/View/Layouts/Emails/html/thin.ctp | 2 +- .../Test/test_app/View/Layouts/Emails/text/default.ctp | 2 +- .../test_app/View/Layouts/Emails/text/japanese.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/ajax.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/ajax2.ctp | 2 +- .../test_app/View/Layouts/cache_empty_sections.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/cache_layout.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/default.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/js/default.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/json/default.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/multi_cache.ctp | 2 +- lib/Cake/Test/test_app/View/Layouts/rss/default.ctp | 8 ++++---- lib/Cake/Test/test_app/View/Layouts/xml/default.ctp | 2 +- .../test_app/View/Themed/TestTheme/Layouts/default.ctp | 2 +- lib/Cake/View/View.php | 2 ++ 35 files changed, 42 insertions(+), 59 deletions(-) diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp index 3cae12115..30fd46e20 100644 --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp @@ -93,7 +93,7 @@ if (!$this->->exists($id)) { throw new NotFoundException(__('Invalid ')); } - if ($this->request->is('post') || $this->request->is('put')) { + if ($this->request->is(array('post', 'put'))) { if ($this->->save($this->request->data)) { $this->Session->setFlash(__('The has been saved.')); diff --git a/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index 2b1c69b93..343eba22a 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.php @@ -226,7 +226,7 @@ class SecurityComponent extends Component { $this->_secureRequired($controller); $this->_authRequired($controller); - $isPost = ($this->request->is('post') || $this->request->is('put')); + $isPost = $this->request->is(array('post', 'put')); $isNotRequestAction = ( !isset($controller->request->params['requested']) || $controller->request->params['requested'] != 1 diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php index 05f60fc40..59ee37657 100644 --- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php @@ -1188,7 +1188,7 @@ class SecurityComponentTest extends CakeTestCase { $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') - ->with('post') + ->with(array('post', 'put')) ->will($this->returnValue(true)); $this->Controller->request->params['action'] = 'index'; @@ -1240,7 +1240,7 @@ class SecurityComponentTest extends CakeTestCase { $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') - ->with('post') + ->with(array('post', 'put')) ->will($this->returnValue(true)); $this->Controller->request->params['action'] = 'index'; @@ -1270,7 +1270,7 @@ class SecurityComponentTest extends CakeTestCase { $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') - ->with('post') + ->with(array('post', 'put')) ->will($this->returnValue(true)); $this->Controller->request->params['action'] = 'index'; @@ -1326,7 +1326,7 @@ class SecurityComponentTest extends CakeTestCase { $this->Controller->request = $this->getMock('CakeRequest', array('is')); $this->Controller->request->expects($this->once())->method('is') - ->with('post') + ->with(array('post', 'put')) ->will($this->returnValue(true)); $this->Controller->request->params['action'] = 'index'; diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index 78a149bb0..45fff9196 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -184,11 +184,11 @@ class TestView extends View { } /** - * TestAfterHelper class + * TestBeforeAfterHelper class * * @package Cake.Test.Case.View */ -class TestAfterHelper extends Helper { +class TestBeforeAfterHelper extends Helper { /** * property property @@ -949,10 +949,10 @@ class ViewTest extends CakeTestCase { * @return void */ public function testBeforeLayout() { - $this->PostsController->helpers = array('Session', 'TestAfter', 'Html'); + $this->PostsController->helpers = array('Session', 'TestBeforeAfter', 'Html'); $View = new View($this->PostsController); $View->render('index'); - $this->assertEquals('Valuation', $View->Helpers->TestAfter->property); + $this->assertEquals('Valuation', $View->Helpers->TestBeforeAfter->property); } /** @@ -961,7 +961,7 @@ class ViewTest extends CakeTestCase { * @return void */ public function testAfterLayout() { - $this->PostsController->helpers = array('Session', 'TestAfter', 'Html'); + $this->PostsController->helpers = array('Session', 'TestBeforeAfter', 'Html'); $this->PostsController->set('variable', 'values'); $View = new View($this->PostsController); diff --git a/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp b/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp index 35bed4c8b..58bc8cf98 100644 --- a/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp +++ b/lib/Cake/Test/bake_compare/Controller/ActionsUsingSessions.ctp @@ -54,7 +54,7 @@ if (!$this->BakeArticle->exists($id)) { throw new NotFoundException(__('Invalid bake article')); } - if ($this->request->is('post') || $this->request->is('put')) { + if ($this->request->is(array('post', 'put'))) { if ($this->BakeArticle->save($this->request->data)) { $this->Session->setFlash(__('The bake article has been saved.')); 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 index 61fb80127..d72105d72 100644 --- a/lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp +++ b/lib/Cake/Test/bake_compare/Controller/ActionsWithNoSessions.ctp @@ -51,7 +51,7 @@ if (!$this->BakeArticle->exists($id)) { throw new NotFoundException(__('Invalid bake article')); } - if ($this->request->is('post') || $this->request->is('put')) { + if ($this->request->is(array('post', 'put'))) { if ($this->BakeArticle->save($this->request->data)) { return $this->flash(__('The bake article has been saved.'), array('action' => 'index')); } diff --git a/lib/Cake/Test/test_app/Controller/TestsAppsController.php b/lib/Cake/Test/test_app/Controller/TestsAppsController.php index d75b8ed39..0c03d2443 100644 --- a/lib/Cake/Test/test_app/Controller/TestsAppsController.php +++ b/lib/Cake/Test/test_app/Controller/TestsAppsController.php @@ -25,8 +25,6 @@ */ class TestsAppsController extends AppController { - public $name = 'TestsApps'; - public $uses = array(); public $components = array('RequestHandler'); diff --git a/lib/Cake/Test/test_app/Controller/TestsAppsPostsController.php b/lib/Cake/Test/test_app/Controller/TestsAppsPostsController.php index 124ebefe9..54228934b 100644 --- a/lib/Cake/Test/test_app/Controller/TestsAppsPostsController.php +++ b/lib/Cake/Test/test_app/Controller/TestsAppsPostsController.php @@ -25,8 +25,6 @@ */ class TestsAppsPostsController extends AppController { - public $name = 'TestsAppsPosts'; - public $uses = array('Post'); public $viewPath = 'TestsApps'; diff --git a/lib/Cake/Test/test_app/Model/Comment.php b/lib/Cake/Test/test_app/Model/Comment.php index d8d0e2a6e..948081d38 100644 --- a/lib/Cake/Test/test_app/Model/Comment.php +++ b/lib/Cake/Test/test_app/Model/Comment.php @@ -34,11 +34,4 @@ class Comment extends AppModel { */ public $useTable = 'comments'; -/** - * Model name - * - * @var string - */ - public $name = 'Comment'; - } diff --git a/lib/Cake/Test/test_app/Model/PersisterOne.php b/lib/Cake/Test/test_app/Model/PersisterOne.php index a88977d11..0012aaf0c 100644 --- a/lib/Cake/Test/test_app/Model/PersisterOne.php +++ b/lib/Cake/Test/test_app/Model/PersisterOne.php @@ -29,8 +29,6 @@ class PersisterOne extends AppModel { public $useTable = 'posts'; - public $name = 'PersisterOne'; - public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne'); public $hasMany = array('Comment', 'TestPlugin.TestPluginComment'); diff --git a/lib/Cake/Test/test_app/Model/PersisterTwo.php b/lib/Cake/Test/test_app/Model/PersisterTwo.php index d7db3a386..d1c077325 100644 --- a/lib/Cake/Test/test_app/Model/PersisterTwo.php +++ b/lib/Cake/Test/test_app/Model/PersisterTwo.php @@ -29,8 +29,6 @@ class PersisterTwo extends AppModel { public $useTable = 'posts'; - public $name = 'PersisterTwo'; - public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne'); public $hasMany = array('Comment', 'TestPlugin.TestPluginComment'); diff --git a/lib/Cake/Test/test_app/Model/Post.php b/lib/Cake/Test/test_app/Model/Post.php index 12672da67..cb0b567d2 100644 --- a/lib/Cake/Test/test_app/Model/Post.php +++ b/lib/Cake/Test/test_app/Model/Post.php @@ -29,6 +29,4 @@ class Post extends AppModel { public $useTable = 'posts'; - public $name = 'Post'; - } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/OtherComponent.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/OtherComponent.php index 0c401b515..1a961d05b 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/OtherComponent.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/OtherComponent.php @@ -23,5 +23,5 @@ * * @package Cake.Test.TestApp.Plugin.TestPlugin.Controller.Component */ -class OtherComponent extends Object { +class OtherComponent extends Component { } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginComponent.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginComponent.php index 5aea69e0e..a2be8f2d5 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginComponent.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginComponent.php @@ -19,12 +19,12 @@ */ /** - * Class TestPluginComponentComponent + * Class TestPluginComponent * * @package Cake.Test.TestApp.Plugin.TestPlugin.Controller.Component */ -class TestPluginComponentComponent extends Object { +class TestPluginComponent extends Component { - public $components = array('TestPlugin.TestPluginOtherComponent'); + public $components = array('TestPlugin.TestPluginOther'); } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginOtherComponent.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginOtherComponent.php index 0d9a04c3b..486ab7f9a 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginOtherComponent.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/Component/TestPluginOtherComponent.php @@ -19,9 +19,9 @@ */ /** - * Class TestPluginOtherComponentComponent + * Class TestPluginOtherComponent * * @package Cake.Test.TestApp.Plugin.TestPlugin.Controller.Component */ -class TestPluginOtherComponentComponent extends Object { +class TestPluginOtherComponent extends Component { } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestsController.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestsController.php index fc7837bb0..2e2595989 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestsController.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Controller/TestsController.php @@ -25,8 +25,6 @@ */ class TestsController extends TestPluginAppController { - public $name = 'Tests'; - public $uses = array(); public $helpers = array('TestPlugin.OtherHelper', 'Html'); diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Elements/translate.ctp b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Elements/translate.ctp index 75b0eab6c..2158bc3d4 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Elements/translate.ctp +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Elements/translate.ctp @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Layouts/Emails/text/plug_default.ctp b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Layouts/Emails/text/plug_default.ctp index 39908fd05..2cd560b8c 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Layouts/Emails/text/plug_default.ctp +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/View/Layouts/Emails/text/plug_default.ctp @@ -1,4 +1,4 @@ - +fetch('content'); ?> This email was sent using the TestPlugin. diff --git a/lib/Cake/Test/test_app/View/Layouts/Emails/html/default.ctp b/lib/Cake/Test/test_app/View/Layouts/Emails/html/default.ctp index cfbd18c8e..801f67d66 100644 --- a/lib/Cake/Test/test_app/View/Layouts/Emails/html/default.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/Emails/html/default.ctp @@ -6,7 +6,7 @@ - + fetch('content'); ?>

This email was sent using the CakePHP Framework

diff --git a/lib/Cake/Test/test_app/View/Layouts/Emails/html/japanese.ctp b/lib/Cake/Test/test_app/View/Layouts/Emails/html/japanese.ctp index 64a912986..abdd170b1 100644 --- a/lib/Cake/Test/test_app/View/Layouts/Emails/html/japanese.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/Emails/html/japanese.ctp @@ -6,7 +6,7 @@ - + fetch('content'); ?>

このメールは CakePHP Framework を利用して送信しました。

diff --git a/lib/Cake/Test/test_app/View/Layouts/Emails/html/thin.ctp b/lib/Cake/Test/test_app/View/Layouts/Emails/html/thin.ctp index 67a43e74c..a6ce47667 100644 --- a/lib/Cake/Test/test_app/View/Layouts/Emails/html/thin.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/Emails/html/thin.ctp @@ -6,7 +6,7 @@ - + fetch('content'); ?>

This email was sent using the CakePHP Framework

diff --git a/lib/Cake/Test/test_app/View/Layouts/Emails/text/default.ctp b/lib/Cake/Test/test_app/View/Layouts/Emails/text/default.ctp index a0d0b982b..e34d3c1dd 100644 --- a/lib/Cake/Test/test_app/View/Layouts/Emails/text/default.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/Emails/text/default.ctp @@ -1,4 +1,4 @@ - +fetch('content'); ?> This email was sent using the CakePHP Framework, http://cakephp.org. \ No newline at end of file diff --git a/lib/Cake/Test/test_app/View/Layouts/Emails/text/japanese.ctp b/lib/Cake/Test/test_app/View/Layouts/Emails/text/japanese.ctp index 374eed2e2..c43b572e1 100644 --- a/lib/Cake/Test/test_app/View/Layouts/Emails/text/japanese.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/Emails/text/japanese.ctp @@ -1,4 +1,4 @@ - +fetch('content'); ?> CakePHP Framework を使って送信したメールです。 http://cakephp.org. \ No newline at end of file diff --git a/lib/Cake/Test/test_app/View/Layouts/ajax.ctp b/lib/Cake/Test/test_app/View/Layouts/ajax.ctp index 3f290130e..0f9da7e17 100644 --- a/lib/Cake/Test/test_app/View/Layouts/ajax.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/ajax.ctp @@ -1 +1 @@ - \ No newline at end of file +fetch('content'); ?> \ No newline at end of file diff --git a/lib/Cake/Test/test_app/View/Layouts/ajax2.ctp b/lib/Cake/Test/test_app/View/Layouts/ajax2.ctp index 54db1c86d..433315990 100644 --- a/lib/Cake/Test/test_app/View/Layouts/ajax2.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/ajax2.ctp @@ -1,2 +1,2 @@ Ajax! - \ No newline at end of file +fetch('content'); ?> \ No newline at end of file diff --git a/lib/Cake/Test/test_app/View/Layouts/cache_empty_sections.ctp b/lib/Cake/Test/test_app/View/Layouts/cache_empty_sections.ctp index 31b7dca4a..3683cff9c 100644 --- a/lib/Cake/Test/test_app/View/Layouts/cache_empty_sections.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/cache_empty_sections.ctp @@ -7,7 +7,7 @@ - + fetch('content'); ?> \ No newline at end of file diff --git a/lib/Cake/Test/test_app/View/Layouts/cache_layout.ctp b/lib/Cake/Test/test_app/View/Layouts/cache_layout.ctp index 71edb98b6..07b664a93 100644 --- a/lib/Cake/Test/test_app/View/Layouts/cache_layout.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/cache_layout.ctp @@ -3,7 +3,7 @@ - +fetch('content'); ?> diff --git a/lib/Cake/Test/test_app/View/Layouts/default.ctp b/lib/Cake/Test/test_app/View/Layouts/default.ctp index eb1aa7b26..bf8cf28dc 100644 --- a/lib/Cake/Test/test_app/View/Layouts/default.ctp +++ b/lib/Cake/Test/test_app/View/Layouts/default.ctp @@ -27,7 +27,7 @@ $cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework
- + fetch('content'); ?>