Browse Source

Correct atom creation-date element

master
J. King 4 years ago
parent
commit
14f6381ae1
  1. 2
      lib/Parser/XML/Entry.php
  2. 4
      tests/cases/XML/entry-atom.yaml
  3. 2
      tests/cases/XML/entry-mixed.yaml
  4. 2
      tests/cases/XML/feed-atom.yaml

2
lib/Parser/XML/Entry.php

@ -98,7 +98,7 @@ class Entry extends Construct implements \MensBeam\Lax\Parser\Entry {
formats are equal, and we want the earliest date, but only if formats are equal, and we want the earliest date, but only if
there are at least two there are at least two
*/ */
return $this->fetchDate("atom:created", self::DATE_EARLIEST) // Atom creation date return $this->fetchDate("atom:published", self::DATE_EARLIEST) // Atom creation date
?? $this->fetchDate("dct:created|dc:created", self::DATE_LATEST) // Dublin Core creation date ?? $this->fetchDate("dct:created|dc:created", self::DATE_LATEST) // Dublin Core creation date
?? $this->getAssumedDateCreated(); // Earliest other date ?? $this->getAssumedDateCreated(); // Earliest other date
} }

4
tests/cases/XML/entry-atom.yaml

@ -99,8 +99,8 @@ Creation and update dates:
input: > input: >
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<entry> <entry>
<created>2020-01-01T00:00:00Z</created> <published>2020-01-01T00:00:00Z</published>
<created>2020-03-03T00:00:00Z</created> <published>2020-03-03T00:00:00Z</published>
<updated>2020-03-03T00:00:00Z</updated> <updated>2020-03-03T00:00:00Z</updated>
<updated>2020-04-01T00:00:00Z</updated> <updated>2020-04-01T00:00:00Z</updated>
</entry> </entry>

2
tests/cases/XML/entry-mixed.yaml

@ -24,7 +24,7 @@ Update and creation dates:
<pubDate>2020-03-03T00:00:00Z</pubDate> <pubDate>2020-03-03T00:00:00Z</pubDate>
</item> </item>
<item> <item>
<atom:created>2020-03-03T00:00:00Z</atom:created> <atom:published>2020-03-03T00:00:00Z</atom:published>
<lastBuildDate>2020-01-01T00:00:00Z</lastBuildDate> <lastBuildDate>2020-01-01T00:00:00Z</lastBuildDate>
</item> </item>
<item> <item>

2
tests/cases/XML/feed-atom.yaml

@ -389,7 +389,7 @@ Multiple feed date timezones:
Bogus feed date: Bogus feed date:
input: > input: >
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<created>2020-03-03T00:00:00Z</created> <published>2020-03-03T00:00:00Z</published>
</feed> </feed>
output: output:
format: atom format: atom

Loading…
Cancel
Save