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 = <<<RSS <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>Channel title</title> <link>/</link> <description/> <item> <guid isPermalink="false">Testing</guid> </item> <item> <guid isPermalink="true">/Testing</guid> </item> <item> <guid>/Testing</guid> </item> </channel> </rss> RSS; $this->assertTextEquals($expected, $result); }
/** * RssViewTest::testSerializeWithSpecialChars() * * @return void */ public function testSerializeWithSpecialChars() { $Request = new Request(); $Response = new Response(); $data = ['channel' => ['title' => 'Channel title with äöü umlauts and <!> special chars', 'link' => 'http://channel.example.org'], 'items' => [['title' => 'A <unsafe title', 'link' => ['controller' => 'foo', 'action' => 'bar'], 'description' => 'My content "&" and <other> stuff here should also be escaped safely']]]; $viewVars = ['channel' => $data, '_serialize' => 'channel']; $View = new RssView($Request, $Response, null, ['viewVars' => $viewVars]); $result = $View->render(false); $expected = <<<RSS <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"> <channel> <title>Channel title with äöü umlauts and <!> special chars</title> <link>http://channel.example.org</link> <description/> <item> <title>A <unsafe title</title> <link>{$this->baseUrl}/foo/bar</link> <description>My content "&" and <other> stuff here should also be escaped safely</description> </item> </channel> </rss> RSS; $this->assertTextEquals($expected, $result); }