From aaa021ab717c3e45821a844ff14fccc864f1e353 Mon Sep 17 00:00:00 2001 From: "marc.wuerth" Date: Fri, 26 Apr 2024 13:06:30 +0200 Subject: [PATCH 1/2] Correct asserted view code --- tests/comparisons/Template/testBakeView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/comparisons/Template/testBakeView.php b/tests/comparisons/Template/testBakeView.php index 87070285..987ea205 100644 --- a/tests/comparisons/Template/testBakeView.php +++ b/tests/comparisons/Template/testBakeView.php @@ -28,7 +28,7 @@ - has('profile') ? $this->Html->link($author->profile->id, ['controller' => 'Profiles', 'action' => 'view', $author->profile->id]) : '' ?> + has('profile') ? $this->Html->link($author->profile->nick, ['controller' => 'Profiles', 'action' => 'view', $author->profile->id]) : '' ?> From b4167f80af5fc974cbe3a07969657b85f3b64cc3 Mon Sep 17 00:00:00 2001 From: "marc.wuerth" Date: Fri, 26 Apr 2024 20:39:18 +0200 Subject: [PATCH 2/2] Skip test case that behaves differently with older CakePHP versions --- tests/TestCase/Command/TemplateCommandTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/TestCase/Command/TemplateCommandTest.php b/tests/TestCase/Command/TemplateCommandTest.php index 192fcf82..3ce5cd52 100644 --- a/tests/TestCase/Command/TemplateCommandTest.php +++ b/tests/TestCase/Command/TemplateCommandTest.php @@ -439,6 +439,11 @@ public function testGetContentWithRoutingPrefix() */ public function testBakeView() { + if (version_compare(Configure::version(), '4.5.0', '<')) { + $this->markTestSkipped( + 'CakePHP versions older than 4.5.0 will generate `$author->profile->nick` instead of `$author->profile->id`' + ); + } $this->generatedFile = ROOT . 'templates/Authors/view.php'; $this->exec('bake template authors view');