Make base work
[catagits/XML-Feed.git] / t / 11-xml-base-atom.t
1 # $Id: $
2
3 use strict;
4 use Test::More tests => 13;
5 use XML::Feed;
6
7
8 my $feed    = XML::Feed->parse('t/samples/base_atom.xml');
9 my ($entry) = $feed->entries;
10 my $content = $entry->content;
11 is($feed->base,    "http://example.org/",                         "Got feed base");
12 is($entry->base,   "http://example.org/archives/",                "Got entry base");
13 is($content->base, "http://example.org/archives/000001.html",     "Got content base");
14
15 my $xml = $feed->as_xml;
16 my $new;
17 ok($new =  XML::Feed->parse(\$xml),                               "Parsed old feed");
18 my ($new_entry)  = $new->entries;
19 my $new_content  = $entry->content;
20 is($new->base,         "http://example.org/",                     "Got feed base");
21 is($new_entry->base,   "http://example.org/archives/",            "Got entry base");
22 is($new_content->base, "http://example.org/archives/000001.html", "Got content base");
23
24
25 ok($feed->base("http://foo.com/"),                                "Set feed base");
26 ok($entry->base("http://foo.com/archives/"),                      "Set entry base");
27 ok($content->base("http://foo.com/archives/000001.html"),         "Set content base");
28
29 is($feed->base,    "http://foo.com/",                             "Got feed base");
30 is($entry->base,   "http://foo.com/archives/",                    "Got entry base");
31 is($content->base, "http://foo.com/archives/000001.html",         "Got content base");
32