From 0e66b0e5eb31e5bf54a4c4d393514eeb6715d60c Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 18 Jun 2024 23:48:21 -0400 Subject: [PATCH] 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