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