diff --git a/src/View/RssView.php b/src/View/RssView.php index c1de5196..858e758f 100644 --- a/src/View/RssView.php +++ b/src/View/RssView.php @@ -310,7 +310,9 @@ protected function _prepareOutput($item) { } $val = $attrib; } elseif (is_array($val) && isset($val['url'])) { - $val['url'] = Router::url($val['url'], true); + if (!isset($val['@isPermalink']) || $val['@isPermalink'] !== 'false') { + $val['url'] = Router::url($val['url'], true); + } if ($bareKey === 'guid') { $val['@'] = $val['url']; unset($val['url']); diff --git a/tests/TestCase/View/RssViewTest.php b/tests/TestCase/View/RssViewTest.php index bf3e560a..8c0566ec 100644 --- a/tests/TestCase/View/RssViewTest.php +++ b/tests/TestCase/View/RssViewTest.php @@ -645,6 +645,54 @@ public function testMedia() { +RSS; + $this->assertTextEquals($expected, $result); + } + + public function testIsPermalink() { + $Request = new Request(); + $Response = new Response(); + + $data = [ + 'channel' => [ + 'title' => 'Channel title', + ], + 'items' => [ + [ + 'guid' => ['url' => 'Testing', '@isPermalink' => 'false'], + ], + [ + 'guid' => ['url' => 'Testing', '@isPermalink' => 'true'], + ], + [ + 'guid' => ['url' => 'Testing'], + ], + ] + ]; + + $viewVars = ['channel' => $data, '_serialize' => 'channel']; + $View = new RssView($Request, $Response, null, ['viewVars' => $viewVars]); + $result = $View->render(false); + + $expected = << + + + Channel title + / + + + Testing + + + /Testing + + + /Testing + + + + RSS; $this->assertTextEquals($expected, $result); }