4 * Copyright 2010 Sébastien Le Callonnec
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * @author: Sébastien Le Callonnec
25 require_once('lib/plugin/AtomFeed.php');
26 require_once('lib/AtomParser.php');
27 require_once('lib/HtmlElement.php');
30 extends phpwiki_TestCase
32 var $atom_feed_plugin;
34 public function setUp() {
36 $this->atom_feed_plugin = new WikiPlugin_AtomFeed();
39 public function testRunMaxItem() {
41 $expected_html = <<<EXPECTED
42 <div class="rss"><h3><a href="http://www.phpwiki.org/fakeurl">This is a fake feed</a></h3>
44 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire</a></dt>
45 <dd><div xmlns="http://www.w3.org/1999/xhtml">Millenium Spire, Dublin
46 <div class="geo">Geo coordinates:
47 <abbr class="latitude" title="53.349441">53.349441</abbr>
48 <abbr class="longitude" title="-6.260282">-6.260282</abbr>
54 $html = $this->atom_feed_plugin->run(null, 'url=file://' . dirname(__FILE__) . '/atom-example.xml maxitem=1', $request, '.');
55 $this->assertEquals($expected_html, trim(html_entity_decode($html->asXML())));
58 public function testRunTitleOnly() {
60 $expected_html = <<<EXPECTED
61 <div class="rss"><h3><a href="http://www.phpwiki.org/fakeurl">This is a fake feed</a></h3>
63 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire</a></dt>
65 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 2</a></dt>
67 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 3</a></dt>
69 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 4</a></dt>
71 <dt><a href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8">Foobar Éire 5</a></dt>
76 $html = $this->atom_feed_plugin->run(null, 'url=file://' . dirname(__FILE__) . '/atom-example.xml titleonly=true', $request, '.');
77 $this->assertEquals($expected_html, trim(html_entity_decode($html->asXML())));