| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More; |
| 4 |
|
| 5 |
use XML::Feed; |
| 6 |
use XML::Feed::Entry; |
| 7 |
use DateTime; |
| 8 |
|
| 9 |
# https://rt.cpan.org/Public/Bug/Display.html?id=124346 |
| 10 |
|
| 11 |
my $feed = XML::Feed->new('RSS'); |
| 12 |
my $dt = DateTime->now; |
| 13 |
|
| 14 |
$feed->title("My Atom feed"); |
| 15 |
$feed->link("http://www.example.com"); |
| 16 |
$feed->author("Author"); |
| 17 |
$feed->updated($dt); |
| 18 |
$feed->id("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344eaa6a"); |
| 19 |
|
| 20 |
my $entry = XML::Feed::Entry->new('RSS'); |
| 21 |
$entry->title("Title"); |
| 22 |
$entry->author("Author"); |
| 23 |
$entry->issued($dt); |
| 24 |
$entry->id("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"); |
| 25 |
|
| 26 |
ok(!$entry->summary->body, "Entry has so no summary"); |
| 27 |
ok(!$entry->content->body, "Entry has so no content"); |
| 28 |
|
| 29 |
my $summary = "Summary"; |
| 30 |
$entry->summary($summary); |
| 31 |
|
| 32 |
is($entry->summary->body, $summary, "Set summary..."); |
| 33 |
is($entry->content->body, $summary, "...did not add dummy content"); |
| 34 |
|
| 35 |
$feed->add_entry($entry); |
| 36 |
|
| 37 |
unlike($feed->as_xml, qr/<content/, "XML has no <content>"); |
| 38 |
|
| 39 |
done_testing(); |