Skip to content

Commit

Permalink
Merge branch 'master' of github.com:davorg/xml-feed
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Mar 12, 2012
2 parents f8b9d33 + fb5c190 commit aa0b6ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lib/XML/Feed/Entry/Format/Atom.pm
Expand Up @@ -145,7 +145,11 @@ sub issued {
if (@_) {
$entry->{entry}->issued(DateTime::Format::W3CDTF->format_datetime($_[0])) if $_[0];
} else {
$entry->{entry}->issued ? iso2dt($entry->{entry}->issued) : undef;
return iso2dt($entry->{entry}->issued)
if $entry->{entry}->issued;
return iso2dt($entry->{entry}->published)
if $entry->{entry}->published;
return undef;
}
}

Expand Down
12 changes: 5 additions & 7 deletions t/07-atom10-create.t
@@ -1,8 +1,6 @@
use strict;
use Test::More;

plan tests => 17;

use XML::Feed;
use DateTime;

Expand All @@ -13,15 +11,15 @@ $feed->title("foo");
$feed->description("Atom 1.0 feed");
$feed->link("http://example.org/");
$feed->id("tag:cpan.org;xml-feed-atom");
$feed->updated($now);
$feed->modified($now);

my $entry = XML::Feed::Entry->new('Atom');
$entry->title("1st Entry");
$entry->link("http://example.org/");
$entry->category("blah");
$entry->content("<p>Hello world.</p>");
$entry->id("tag:cpan.org;xml-feed-atom-entry");
$entry->updated($now);
$entry->modified($now);

$feed->add_entry($entry);

Expand All @@ -37,7 +35,7 @@ is $feed->title, "foo";
is $feed->description, "Atom 1.0 feed";
is $feed->link, "http://example.org/";
is $feed->id, "tag:cpan.org;xml-feed-atom";
is "".$feed->updated, "".$now;
is $feed->modified->iso8601, $now->iso8601;

my @entries = $feed->entries;
is @entries, 1;
Expand All @@ -50,6 +48,6 @@ is $entry->content->type, 'text/html';
like $entry->content->body, qr!\s*<p>Hello world.</p>\s*!s;

is $entry->id, "tag:cpan.org;xml-feed-atom-entry";
is "".$entry->updated, "".$now;

is $entry->modified->iso8601, $now->iso8601;

done_testing();

0 comments on commit aa0b6ff

Please sign in to comment.