Add note about makign a validating URL
[catagits/XML-Feed.git] / t / 11-xml-base-rss.t
CommitLineData
5383a560 1# $Id: $
2
3use strict;
e3b96b9c 4use Test::More;
5383a560 5use XML::Feed;
e3b96b9c 6use XML::RSS;
5383a560 7
e3b96b9c 8if ($XML::RSS::VERSION <= 1.36) {
9 plan skip_all => "Version of XML::RSS is too old to do xml:base";
10} else {
11 plan tests => 13;
12}
5383a560 13
14my $feed = XML::Feed->parse('t/samples/base_rss.xml');
e3b96b9c 15
5383a560 16my ($entry) = $feed->entries;
17my $content = $entry->content;
7c89ffff 18is($feed->base, "http://example.org/", "Got feed base");
19is($entry->base, "http://example.org/archives/", "Got entry base");
20is($content->base, "http://example.org/archives/000001.html", "Got content base");
21
22my $xml = $feed->as_xml;
23my $new;
24ok($new = XML::Feed->parse(\$xml), "Parsed old feed");
25my ($new_entry) = $new->entries;
26my $new_content = $entry->content;
27is($new->base, "http://example.org/", "Got feed base");
28is($new_entry->base, "http://example.org/archives/", "Got entry base");
29is($new_content->base, "http://example.org/archives/000001.html", "Got content base");
30
31
32ok($feed->base("http://foo.com/"), "Set feed base");
33ok($entry->base("http://foo.com/archives/"), "Set entry base");
34ok($content->base("http://foo.com/archives/000001.html"), "Set content base");
35
36is($feed->base, "http://foo.com/", "Got feed base");
37is($entry->base, "http://foo.com/archives/", "Got entry base");
38is($content->base, "http://foo.com/archives/000001.html", "Got content base");
39
40