Skip to content

Commit

Permalink
Merge pull request #986 from cakephp/2.x-assert-nick
Browse files Browse the repository at this point in the history
[2.x] Correct asserted view code
  • Loading branch information
dereuromark authored Apr 26, 2024
2 parents f90d514 + b4167f8 commit 7d7c919
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/TestCase/Command/TemplateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Template/testBakeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</tr>
<tr>
<th><?= __('Profile') ?></th>
<td><?= $author->has('profile') ? $this->Html->link($author->profile->id, ['controller' => 'Profiles', 'action' => 'view', $author->profile->id]) : '' ?></td>
<td><?= $author->has('profile') ? $this->Html->link($author->profile->nick, ['controller' => 'Profiles', 'action' => 'view', $author->profile->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Id') ?></th>
Expand Down

0 comments on commit 7d7c919

Please sign in to comment.