# $Id$
use strict;
-use Test::More tests => 69;
+use Test::More tests => 72;
use XML::Feed;
use XML::Feed::Entry;
use XML::Feed::Content;
for my $format (qw( Atom RSS )) {
my $feed = XML::Feed->new($format);
- isa_ok($feed, 'XML::Feed::' . $format);
+ isa_ok($feed, 'XML::Feed::Format::' . $format);
like($feed->format, qr/^$format/, 'Format is correct');
$feed->title('My Feed');
is($feed->title, 'My Feed', 'feed title is correct');
ok($feed->as_xml, 'as_xml returns something');
my $entry = XML::Feed::Entry->new($format);
- isa_ok($entry, 'XML::Feed::Entry::' . $format);
+ isa_ok($entry, 'XML::Feed::Entry::Format::' . $format);
$entry->title('Foo Bar');
is($entry->title, 'Foo Bar', 'entry title is correct');
$entry->link('http://www.example.com/foo/bar.html');
if ($format eq 'Atom') {
like $feed->as_xml, qr/This is the content/;
}
+ if ($format eq 'RSS') {
+ like $feed->as_xml, qr{xmlns:dcterms="http://purl.org/dc/terms/"};
+ }
+
+ $feed->self_link("http://tor.tld/my-feed.rss");
+
+ if ($format eq "RSS")
+ {
+ like ($feed->as_xml(), qr{\Q<atom:link href="http://tor.tld/my-feed.rss" rel="self" type="application/rss+xml"/>\E},
+ "Feed contains the atom:link");
+ }
+ elsif ($format eq "Atom")
+ {
+ like ($feed->as_xml(), qr{\Q<link rel="self" href="http://tor.tld/my-feed.rss" type="application/atom+xml"/>\E},
+ "Feed contains the atom:link");
+ }
+
}