From 993e31ff3037fdd7568d148a1f76d2549742860f Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 18 Jun 2024 23:41:31 -0400 Subject: [PATCH 1/5] Add logic to command to autodetect Authorization plugin Add the Authorization component if no explicit list of components was requested. --- src/Command/ControllerCommand.php | 5 +++ .../Command/ControllerCommandTest.php | 36 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Command/ControllerCommand.php b/src/Command/ControllerCommand.php index 7a04425d..d7f5ab5f 100644 --- a/src/Command/ControllerCommand.php +++ b/src/Command/ControllerCommand.php @@ -21,6 +21,7 @@ use Cake\Console\ConsoleIo; use Cake\Console\ConsoleOptionParser; use Cake\Core\Configure; +use Cake\Core\Plugin; use Cake\Datasource\ConnectionManager; /** @@ -219,6 +220,10 @@ public function getComponents(Arguments $args): array if ($args->getOption('components')) { $components = explode(',', $args->getOption('components')); $components = array_values(array_filter(array_map('trim', $components))); + } else { + if (Plugin::isLoaded('Authorization')) { + $components[] = 'Authorization.Authorization'; + } } return $components; diff --git a/tests/TestCase/Command/ControllerCommandTest.php b/tests/TestCase/Command/ControllerCommandTest.php index b3474141..f4a93e0f 100644 --- a/tests/TestCase/Command/ControllerCommandTest.php +++ b/tests/TestCase/Command/ControllerCommandTest.php @@ -66,7 +66,7 @@ public function tearDown(): void parent::tearDown(); $this->getTableLocator()->clear(); - $this->removePlugins(['ControllerTest', 'Company/Pastry']); + $this->removePlugins(['ControllerTest', 'Company/Pastry', 'Authorization', 'BakeTest']); } /** @@ -102,6 +102,25 @@ public function testGetComponents() $this->assertSame(['Auth', 'RequestHandler'], $result); } + /** + * test component generation with auto-detect for core plugins + * + * @return void + */ + public function testGetComponentsInferredDefaults() + { + $this->_loadTestPlugin('Authorization'); + + $command = new ControllerCommand(); + $args = new Arguments([], [], []); + $result = $command->getComponents($args); + $this->assertSame(['Authorization.Authorization'], $result); + + $args = new Arguments([], ['components' => 'Flash, FormProtection'], []); + $result = $command->getComponents($args); + $this->assertSame(['Flash', 'FormProtection'], $result); + } + /** * test helper generation * @@ -193,6 +212,21 @@ public function testBakeActions() $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } + /** + * Test the integration with Authorization plugin + */ + public function testBakeActionsAuthorizationPlugin() + { + $this->_loadTestPlugin('Authorization'); + + $this->generatedFile = APP . 'Controller/BakeArticlesController.php'; + $this->exec('bake controller --connection test --no-test BakeArticles'); + + $this->assertExitCode(CommandInterface::CODE_SUCCESS); + $result = file_get_contents($this->generatedFile); + $this->assertSameAsFile(__FUNCTION__ . '.php', $result); + } + /** * test bake actions prefixed. * From 3d7e7eb3b0e147ba462658994bb5cdee85d7ca34 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 18 Jun 2024 23:42:20 -0400 Subject: [PATCH 2/5] Update templates for Authorization I had to fix line endings in several files as our templates were missing terminating newlines and that's no way to live. --- templates/bake/Controller/controller.twig | 4 +- templates/bake/element/Controller/add.twig | 5 +- templates/bake/element/Controller/delete.twig | 5 +- templates/bake/element/Controller/edit.twig | 5 +- templates/bake/element/Controller/index.twig | 5 +- templates/bake/element/Controller/view.twig | 5 +- .../Controller/testBakeActions.php | 2 +- .../testBakeActionsAuthorizationPlugin.php | 123 ++++++++++++++++++ .../Controller/testBakeActionsContent.php | 2 +- .../Controller/testBakeActionsOption.php | 2 +- .../Controller/testBakeComponents.php | 2 +- .../Controller/testBakeNoActions.php | 2 +- .../Authorization/src/AuthorizationPlugin.php | 14 ++ .../Component/AuthorizationComponent.php | 10 ++ 14 files changed, 174 insertions(+), 12 deletions(-) create mode 100644 tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php create mode 100644 tests/test_app/Plugin/Authorization/src/AuthorizationPlugin.php create mode 100644 tests/test_app/Plugin/Authorization/src/Controller/Component/AuthorizationComponent.php diff --git a/templates/bake/Controller/controller.twig b/templates/bake/Controller/controller.twig index aabc537e..6175c272 100644 --- a/templates/bake/Controller/controller.twig +++ b/templates/bake/Controller/controller.twig @@ -57,6 +57,6 @@ class {{ name }}Controller extends AppController {% endif %} {%- for action in actions %} {% if loop.index > 1 %}{{ "\n" }}{% endif %} - {{- element('Bake.Controller/' ~ action) -}} + {{- element('Bake.Controller/' ~ action) }} {% endfor %} -} +} \ No newline at end of file diff --git a/templates/bake/element/Controller/add.twig b/templates/bake/element/Controller/add.twig index 0e003205..7751ef94 100644 --- a/templates/bake/element/Controller/add.twig +++ b/templates/bake/element/Controller/add.twig @@ -22,6 +22,9 @@ public function add() { ${{ singularName }} = $this->{{ currentModelName }}->newEmptyEntity(); +{% if Bake.hasPlugin('Authorization') %} + $this->Authorization->authorize(${{ singularName }}); +{% endif %} if ($this->request->is('post')) { ${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData()); if ($this->{{ currentModelName }}->save(${{ singularName }})) { @@ -42,4 +45,4 @@ {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} $this->set(compact({{ compact|join(', ')|raw }})); - } + } \ No newline at end of file diff --git a/templates/bake/element/Controller/delete.twig b/templates/bake/element/Controller/delete.twig index 53e57dac..669a6a82 100644 --- a/templates/bake/element/Controller/delete.twig +++ b/templates/bake/element/Controller/delete.twig @@ -24,6 +24,9 @@ { $this->request->allowMethod(['post', 'delete']); ${{ singularName }} = $this->{{ currentModelName }}->get($id); +{% if Bake.hasPlugin('Authorization') %} + $this->Authorization->authorize(${{ singularName }}); +{% endif %} if ($this->{{ currentModelName }}->delete(${{ singularName }})) { $this->Flash->success(__('The {{ singularHumanName|lower }} has been deleted.')); } else { @@ -31,4 +34,4 @@ } return $this->redirect(['action' => 'index']); - } + } \ No newline at end of file diff --git a/templates/bake/element/Controller/edit.twig b/templates/bake/element/Controller/edit.twig index e6b2164d..8bd61a1d 100644 --- a/templates/bake/element/Controller/edit.twig +++ b/templates/bake/element/Controller/edit.twig @@ -26,6 +26,9 @@ public function edit($id = null) { ${{ singularName }} = $this->{{ currentModelName }}->get($id, contain: {{ Bake.exportArray(belongsToMany)|raw }}); +{% if Bake.hasPlugin('Authorization') %} + $this->Authorization->authorize(${{ singularName }}); +{% endif %} if ($this->request->is(['patch', 'post', 'put'])) { ${{ singularName }} = $this->{{ currentModelName }}->patchEntity(${{ singularName }}, $this->request->getData()); if ($this->{{ currentModelName }}->save(${{ singularName }})) { @@ -43,4 +46,4 @@ {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} $this->set(compact({{ compact|join(', ')|raw }})); - } + } \ No newline at end of file diff --git a/templates/bake/element/Controller/index.twig b/templates/bake/element/Controller/index.twig index fb136ec5..3623beb7 100644 --- a/templates/bake/element/Controller/index.twig +++ b/templates/bake/element/Controller/index.twig @@ -26,8 +26,11 @@ ->contain({{ Bake.exportArray(belongsTo)|raw }}); {% else %} $query = $this->{{ currentModelName }}->find(); +{% endif %} +{% if Bake.hasPlugin('Authorization') %} + $query = $this->Authorization->applyScope($query); {% endif %} ${{ pluralName }} = $this->paginate($query); $this->set(compact('{{ pluralName }}')); - } + } \ No newline at end of file diff --git a/templates/bake/element/Controller/view.twig b/templates/bake/element/Controller/view.twig index 3d7cdf8d..9ff768fe 100644 --- a/templates/bake/element/Controller/view.twig +++ b/templates/bake/element/Controller/view.twig @@ -27,5 +27,8 @@ public function view($id = null) { ${{ singularName }} = $this->{{ currentModelName }}->get($id, contain: {{ Bake.exportArray(allAssociations)|raw }}); +{% if Bake.hasPlugin('Authorization') %} + $this->Authorization->authorize(${{ singularName }}); +{% endif %} $this->set(compact('{{ singularName }}')); - } + } \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeActions.php b/tests/comparisons/Controller/testBakeActions.php index ff924991..a5e0d9b3 100644 --- a/tests/comparisons/Controller/testBakeActions.php +++ b/tests/comparisons/Controller/testBakeActions.php @@ -118,4 +118,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} +} \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php b/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php new file mode 100644 index 00000000..84acd207 --- /dev/null +++ b/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php @@ -0,0 +1,123 @@ +loadComponent('Authorization.Authorization'); + } + + /** + * Index method + * + * @return \Cake\Http\Response|null|void Renders view + */ + public function index() + { + $query = $this->BakeArticles->find() + ->contain(['BakeUsers']); + $query = $this->Authorization->applyScope($query); + $bakeArticles = $this->paginate($query); + + $this->set(compact('bakeArticles')); + } + + /** + * View method + * + * @param string|null $id Bake Article id. + * @return \Cake\Http\Response|null|void Renders view + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function view($id = null) + { + $bakeArticle = $this->BakeArticles->get($id, contain: ['BakeUsers', 'BakeTags', 'BakeComments']); + $this->Authorization->authorize($bakeArticle); + $this->set(compact('bakeArticle')); + } + + /** + * Add method + * + * @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise. + */ + public function add() + { + $bakeArticle = $this->BakeArticles->newEmptyEntity(); + $this->Authorization->authorize($bakeArticle); + if ($this->request->is('post')) { + $bakeArticle = $this->BakeArticles->patchEntity($bakeArticle, $this->request->getData()); + if ($this->BakeArticles->save($bakeArticle)) { + $this->Flash->success(__('The bake article has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The bake article could not be saved. Please, try again.')); + } + $bakeUsers = $this->BakeArticles->BakeUsers->find('list', limit: 200)->all(); + $bakeTags = $this->BakeArticles->BakeTags->find('list', limit: 200)->all(); + $this->set(compact('bakeArticle', 'bakeUsers', 'bakeTags')); + } + + /** + * Edit method + * + * @param string|null $id Bake Article id. + * @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function edit($id = null) + { + $bakeArticle = $this->BakeArticles->get($id, contain: ['BakeTags']); + $this->Authorization->authorize($bakeArticle); + if ($this->request->is(['patch', 'post', 'put'])) { + $bakeArticle = $this->BakeArticles->patchEntity($bakeArticle, $this->request->getData()); + if ($this->BakeArticles->save($bakeArticle)) { + $this->Flash->success(__('The bake article has been saved.')); + + return $this->redirect(['action' => 'index']); + } + $this->Flash->error(__('The bake article could not be saved. Please, try again.')); + } + $bakeUsers = $this->BakeArticles->BakeUsers->find('list', limit: 200)->all(); + $bakeTags = $this->BakeArticles->BakeTags->find('list', limit: 200)->all(); + $this->set(compact('bakeArticle', 'bakeUsers', 'bakeTags')); + } + + /** + * Delete method + * + * @param string|null $id Bake Article id. + * @return \Cake\Http\Response|null Redirects to index. + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. + */ + public function delete($id = null) + { + $this->request->allowMethod(['post', 'delete']); + $bakeArticle = $this->BakeArticles->get($id); + $this->Authorization->authorize($bakeArticle); + if ($this->BakeArticles->delete($bakeArticle)) { + $this->Flash->success(__('The bake article has been deleted.')); + } else { + $this->Flash->error(__('The bake article could not be deleted. Please, try again.')); + } + + return $this->redirect(['action' => 'index']); + } +} \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeActionsContent.php b/tests/comparisons/Controller/testBakeActionsContent.php index 8f3df094..351e9ffd 100644 --- a/tests/comparisons/Controller/testBakeActionsContent.php +++ b/tests/comparisons/Controller/testBakeActionsContent.php @@ -102,4 +102,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} +} \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeActionsOption.php b/tests/comparisons/Controller/testBakeActionsOption.php index d3ec9103..1f1fb08f 100644 --- a/tests/comparisons/Controller/testBakeActionsOption.php +++ b/tests/comparisons/Controller/testBakeActionsOption.php @@ -39,4 +39,4 @@ public function index() $this->set(compact('bakeArticles')); } -} +} \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeComponents.php b/tests/comparisons/Controller/testBakeComponents.php index 6555c029..e18374e3 100644 --- a/tests/comparisons/Controller/testBakeComponents.php +++ b/tests/comparisons/Controller/testBakeComponents.php @@ -32,4 +32,4 @@ public function initialize(): void $this->loadComponent('Apple'); $this->loadComponent('NonExistent'); } -} +} \ No newline at end of file diff --git a/tests/comparisons/Controller/testBakeNoActions.php b/tests/comparisons/Controller/testBakeNoActions.php index fa3ae09b..110f7a5a 100644 --- a/tests/comparisons/Controller/testBakeNoActions.php +++ b/tests/comparisons/Controller/testBakeNoActions.php @@ -25,4 +25,4 @@ public function initialize(): void $this->loadComponent('Flash'); $this->viewBuilder()->setHelpers(['Html', 'Time']); } -} +} \ No newline at end of file diff --git a/tests/test_app/Plugin/Authorization/src/AuthorizationPlugin.php b/tests/test_app/Plugin/Authorization/src/AuthorizationPlugin.php new file mode 100644 index 00000000..7f7636bf --- /dev/null +++ b/tests/test_app/Plugin/Authorization/src/AuthorizationPlugin.php @@ -0,0 +1,14 @@ + Date: Tue, 18 Jun 2024 23:48:21 -0400 Subject: [PATCH 3/5] Fix newlines Remove editorconfig that was doing the wrong thing and removing trailing newlines. --- .editorconfig | 3 --- templates/bake/Controller/controller.twig | 2 +- templates/bake/element/Controller/add.twig | 2 +- templates/bake/element/Controller/delete.twig | 2 +- templates/bake/element/Controller/edit.twig | 2 +- templates/bake/element/Controller/index.twig | 2 +- templates/bake/element/Controller/view.twig | 2 +- tests/TestCase/Command/ControllerCommandTest.php | 6 +++--- tests/comparisons/Controller/testBakeWithPlugin.php | 2 +- 9 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.editorconfig b/.editorconfig index 6801c475..34dc77a6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,6 +16,3 @@ indent_size = 2 [phars.xml] indent_size = 2 - -[*.twig] -insert_final_newline = false diff --git a/templates/bake/Controller/controller.twig b/templates/bake/Controller/controller.twig index 6175c272..89e57d38 100644 --- a/templates/bake/Controller/controller.twig +++ b/templates/bake/Controller/controller.twig @@ -57,6 +57,6 @@ class {{ name }}Controller extends AppController {% endif %} {%- for action in actions %} {% if loop.index > 1 %}{{ "\n" }}{% endif %} - {{- element('Bake.Controller/' ~ action) }} + {{- element('Bake.Controller/' ~ action) -}} {% endfor %} } \ No newline at end of file diff --git a/templates/bake/element/Controller/add.twig b/templates/bake/element/Controller/add.twig index 7751ef94..081d1c79 100644 --- a/templates/bake/element/Controller/add.twig +++ b/templates/bake/element/Controller/add.twig @@ -45,4 +45,4 @@ {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} $this->set(compact({{ compact|join(', ')|raw }})); - } \ No newline at end of file + } diff --git a/templates/bake/element/Controller/delete.twig b/templates/bake/element/Controller/delete.twig index 669a6a82..bab93c72 100644 --- a/templates/bake/element/Controller/delete.twig +++ b/templates/bake/element/Controller/delete.twig @@ -34,4 +34,4 @@ } return $this->redirect(['action' => 'index']); - } \ No newline at end of file + } diff --git a/templates/bake/element/Controller/edit.twig b/templates/bake/element/Controller/edit.twig index 8bd61a1d..793f8515 100644 --- a/templates/bake/element/Controller/edit.twig +++ b/templates/bake/element/Controller/edit.twig @@ -46,4 +46,4 @@ {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} $this->set(compact({{ compact|join(', ')|raw }})); - } \ No newline at end of file + } diff --git a/templates/bake/element/Controller/index.twig b/templates/bake/element/Controller/index.twig index 3623beb7..0394d966 100644 --- a/templates/bake/element/Controller/index.twig +++ b/templates/bake/element/Controller/index.twig @@ -33,4 +33,4 @@ ${{ pluralName }} = $this->paginate($query); $this->set(compact('{{ pluralName }}')); - } \ No newline at end of file + } diff --git a/templates/bake/element/Controller/view.twig b/templates/bake/element/Controller/view.twig index 9ff768fe..d85bd17a 100644 --- a/templates/bake/element/Controller/view.twig +++ b/templates/bake/element/Controller/view.twig @@ -31,4 +31,4 @@ $this->Authorization->authorize(${{ singularName }}); {% endif %} $this->set(compact('{{ singularName }}')); - } \ No newline at end of file + } diff --git a/tests/TestCase/Command/ControllerCommandTest.php b/tests/TestCase/Command/ControllerCommandTest.php index f4a93e0f..82fd2a25 100644 --- a/tests/TestCase/Command/ControllerCommandTest.php +++ b/tests/TestCase/Command/ControllerCommandTest.php @@ -213,8 +213,8 @@ public function testBakeActions() } /** - * Test the integration with Authorization plugin - */ + * Test the integration with Authorization plugin + */ public function testBakeActionsAuthorizationPlugin() { $this->_loadTestPlugin('Authorization'); @@ -222,7 +222,7 @@ public function testBakeActionsAuthorizationPlugin() $this->generatedFile = APP . 'Controller/BakeArticlesController.php'; $this->exec('bake controller --connection test --no-test BakeArticles'); - $this->assertExitCode(CommandInterface::CODE_SUCCESS); + $this->assertExitSuccess(); $result = file_get_contents($this->generatedFile); $this->assertSameAsFile(__FUNCTION__ . '.php', $result); } diff --git a/tests/comparisons/Controller/testBakeWithPlugin.php b/tests/comparisons/Controller/testBakeWithPlugin.php index fb16c6e7..15e54bda 100644 --- a/tests/comparisons/Controller/testBakeWithPlugin.php +++ b/tests/comparisons/Controller/testBakeWithPlugin.php @@ -104,4 +104,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} +} \ No newline at end of file From 0a33c98e742a898336c4fac7f691721d92011dec Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 18 Jun 2024 23:49:24 -0400 Subject: [PATCH 4/5] More newlines --- templates/bake/Controller/controller.twig | 2 +- tests/comparisons/Controller/testBakeActions.php | 2 +- .../Controller/testBakeActionsAuthorizationPlugin.php | 2 +- tests/comparisons/Controller/testBakeActionsContent.php | 2 +- tests/comparisons/Controller/testBakeActionsOption.php | 2 +- tests/comparisons/Controller/testBakeComponents.php | 2 +- tests/comparisons/Controller/testBakeNoActions.php | 2 +- tests/comparisons/Controller/testBakeWithPlugin.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/bake/Controller/controller.twig b/templates/bake/Controller/controller.twig index 89e57d38..aabc537e 100644 --- a/templates/bake/Controller/controller.twig +++ b/templates/bake/Controller/controller.twig @@ -59,4 +59,4 @@ class {{ name }}Controller extends AppController {% if loop.index > 1 %}{{ "\n" }}{% endif %} {{- element('Bake.Controller/' ~ action) -}} {% endfor %} -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeActions.php b/tests/comparisons/Controller/testBakeActions.php index a5e0d9b3..ff924991 100644 --- a/tests/comparisons/Controller/testBakeActions.php +++ b/tests/comparisons/Controller/testBakeActions.php @@ -118,4 +118,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php b/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php index 84acd207..b37de7f2 100644 --- a/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php +++ b/tests/comparisons/Controller/testBakeActionsAuthorizationPlugin.php @@ -120,4 +120,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeActionsContent.php b/tests/comparisons/Controller/testBakeActionsContent.php index 351e9ffd..8f3df094 100644 --- a/tests/comparisons/Controller/testBakeActionsContent.php +++ b/tests/comparisons/Controller/testBakeActionsContent.php @@ -102,4 +102,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeActionsOption.php b/tests/comparisons/Controller/testBakeActionsOption.php index 1f1fb08f..d3ec9103 100644 --- a/tests/comparisons/Controller/testBakeActionsOption.php +++ b/tests/comparisons/Controller/testBakeActionsOption.php @@ -39,4 +39,4 @@ public function index() $this->set(compact('bakeArticles')); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeComponents.php b/tests/comparisons/Controller/testBakeComponents.php index e18374e3..6555c029 100644 --- a/tests/comparisons/Controller/testBakeComponents.php +++ b/tests/comparisons/Controller/testBakeComponents.php @@ -32,4 +32,4 @@ public function initialize(): void $this->loadComponent('Apple'); $this->loadComponent('NonExistent'); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeNoActions.php b/tests/comparisons/Controller/testBakeNoActions.php index 110f7a5a..fa3ae09b 100644 --- a/tests/comparisons/Controller/testBakeNoActions.php +++ b/tests/comparisons/Controller/testBakeNoActions.php @@ -25,4 +25,4 @@ public function initialize(): void $this->loadComponent('Flash'); $this->viewBuilder()->setHelpers(['Html', 'Time']); } -} \ No newline at end of file +} diff --git a/tests/comparisons/Controller/testBakeWithPlugin.php b/tests/comparisons/Controller/testBakeWithPlugin.php index 15e54bda..fb16c6e7 100644 --- a/tests/comparisons/Controller/testBakeWithPlugin.php +++ b/tests/comparisons/Controller/testBakeWithPlugin.php @@ -104,4 +104,4 @@ public function delete($id = null) return $this->redirect(['action' => 'index']); } -} \ No newline at end of file +} From ea09cfd23708bb15fcab3b1c3b06cc1c92e1acc4 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 1 Jul 2024 13:37:52 -0400 Subject: [PATCH 5/5] revert editorconfig --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 34dc77a6..6801c475 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,3 +16,6 @@ indent_size = 2 [phars.xml] indent_size = 2 + +[*.twig] +insert_final_newline = false