3 * Copyright 2010 Sébastien Le Callonnec
5 * This file is part of PhpWiki.
7 * PhpWiki is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * PhpWiki is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * @author: Sébastien Le Callonnec
24 require_once 'lib/plugin/AtomFeed.php';
25 require_once 'lib/AtomParser.php';
26 require_once 'lib/HtmlElement.php';
29 extends phpwiki_TestCase
31 var $atom_feed_plugin;
33 public function setUp() {
35 $this->atom_feed_plugin = new WikiPlugin_AtomFeed();
38 public function testRunMaxItem() {
40 $expected_html = <<<EXPECTED
41 <div class="rss"><h3><a href="http://www.phpwiki.org/fakeurl">This is a fake feed</a></h3>
43 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire</a></dt>
44 <dd><div xmlns="http://www.w3.org/1999/xhtml">Millenium Spire, Dublin
45 <div class="geo">Geo coordinates:
46 <abbr class="latitude" title="53.349441">53.349441</abbr>
47 <abbr class="longitude" title="-6.260282">-6.260282</abbr>
53 $html = $this->atom_feed_plugin->run(null, 'url=file://' . dirname(__FILE__) . '/atom-example.xml maxitem=1', $request, '.');
54 $this->assertEquals($expected_html, trim(html_entity_decode($html->asXML())));
57 public function testRunTitleOnly() {
59 $expected_html = <<<EXPECTED
60 <div class="rss"><h3><a href="http://www.phpwiki.org/fakeurl">This is a fake feed</a></h3>
62 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire</a></dt>
64 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 2</a></dt>
66 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 3</a></dt>
68 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 4</a></dt>
70 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 5</a></dt>
75 $html = $this->atom_feed_plugin->run(null, 'url=file://' . dirname(__FILE__) . '/atom-example.xml titleonly=true', $request, '.');
76 $this->assertEquals($expected_html, trim(html_entity_decode($html->asXML())));