From 148875c0dd058c4677cac6aa214506aa94be5698 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 22 May 2017 17:06:01 -0400 Subject: [PATCH] Last cache-handling Feed test --- tests/Feed/TestFeed.php | 11 ++++++--- tests/docroot/Feed/Caching/200Future.php | 1 + .../{200RSS2Multiple.php => 200Multiple.php} | 1 + tests/docroot/Feed/Caching/200None.php | 24 +++++++++++++++++++ tests/docroot/Feed/Caching/200Past.php | 1 + ...RSS2PubDateOnly.php => 200PubDateOnly.php} | 1 + ...00RSS2UpdateDate.php => 200UpdateDate.php} | 1 + 7 files changed, 37 insertions(+), 3 deletions(-) rename tests/docroot/Feed/Caching/{200RSS2Multiple.php => 200Multiple.php} (95%) create mode 100644 tests/docroot/Feed/Caching/200None.php rename tests/docroot/Feed/Caching/{200RSS2PubDateOnly.php => 200PubDateOnly.php} (90%) rename tests/docroot/Feed/Caching/{200RSS2UpdateDate.php => 200UpdateDate.php} (92%) diff --git a/tests/Feed/TestFeed.php b/tests/Feed/TestFeed.php index ac2a9f9..bbb301f 100644 --- a/tests/Feed/TestFeed.php +++ b/tests/Feed/TestFeed.php @@ -53,12 +53,17 @@ class TestFeed extends \PHPUnit\Framework\TestCase { $this->assertNotEmpty($f->resource->getETag()); // these tests have no HTTP headers and rely on article dates $t = strtotime("2002-05-19T15:21:36Z"); - $f = new Feed(null, $this->base."Caching/200RSS2PubDateOnly"); + $f = new Feed(null, $this->base."Caching/200PubDateOnly"); $this->assertTime($t, $f->lastModified); - $f = new Feed(null, $this->base."Caching/200RSS2UpdateDate"); + $f = new Feed(null, $this->base."Caching/200UpdateDate"); $this->assertTime($t, $f->lastModified); - $f = new Feed(null, $this->base."Caching/200RSS2Multiple"); + $f = new Feed(null, $this->base."Caching/200Multiple"); $this->assertTime($t, $f->lastModified); + // this test has no dates at all and should report the current time + $t = time(); + $f = new Feed(null, $this->base."Caching/200None"); + $this->assertTime($t, $f->lastModified); + } function testComputeNextFetchOnError() { diff --git a/tests/docroot/Feed/Caching/200Future.php b/tests/docroot/Feed/Caching/200Future.php index 0de46b5..37c85a1 100644 --- a/tests/docroot/Feed/Caching/200Future.php +++ b/tests/docroot/Feed/Caching/200Future.php @@ -1,5 +1,6 @@ 200, + 'mime' => "application/rss+xml", 'lastMod' => time() + 2000, 'content' => << diff --git a/tests/docroot/Feed/Caching/200RSS2Multiple.php b/tests/docroot/Feed/Caching/200Multiple.php similarity index 95% rename from tests/docroot/Feed/Caching/200RSS2Multiple.php rename to tests/docroot/Feed/Caching/200Multiple.php index c34d92a..0594401 100644 --- a/tests/docroot/Feed/Caching/200RSS2Multiple.php +++ b/tests/docroot/Feed/Caching/200Multiple.php @@ -1,6 +1,7 @@ 200, 'cache' => false, + 'mime' => "application/rss+xml", 'content' => << diff --git a/tests/docroot/Feed/Caching/200None.php b/tests/docroot/Feed/Caching/200None.php new file mode 100644 index 0000000..513cb66 --- /dev/null +++ b/tests/docroot/Feed/Caching/200None.php @@ -0,0 +1,24 @@ + 200, + 'cache' => false, + 'mime' => "application/rss+xml", + 'content' => << + + Test feed + http://example.com/ + A basic feed for testing + + + Sample article 1 + + + Sample article 2 + + + Sample article 3 + + + +MESSAGE_BODY +]; \ No newline at end of file diff --git a/tests/docroot/Feed/Caching/200Past.php b/tests/docroot/Feed/Caching/200Past.php index 09a28c1..7d69cf5 100644 --- a/tests/docroot/Feed/Caching/200Past.php +++ b/tests/docroot/Feed/Caching/200Past.php @@ -1,6 +1,7 @@ 200, 'lastMod' => time() - 2000, + 'mime' => "application/rss+xml", 'content' => << diff --git a/tests/docroot/Feed/Caching/200RSS2PubDateOnly.php b/tests/docroot/Feed/Caching/200PubDateOnly.php similarity index 90% rename from tests/docroot/Feed/Caching/200RSS2PubDateOnly.php rename to tests/docroot/Feed/Caching/200PubDateOnly.php index b501a92..fdd39e0 100644 --- a/tests/docroot/Feed/Caching/200RSS2PubDateOnly.php +++ b/tests/docroot/Feed/Caching/200PubDateOnly.php @@ -1,6 +1,7 @@ 200, 'cache' => false, + 'mime' => "application/rss+xml", 'content' => << diff --git a/tests/docroot/Feed/Caching/200RSS2UpdateDate.php b/tests/docroot/Feed/Caching/200UpdateDate.php similarity index 92% rename from tests/docroot/Feed/Caching/200RSS2UpdateDate.php rename to tests/docroot/Feed/Caching/200UpdateDate.php index 6d7bc25..2128d2c 100644 --- a/tests/docroot/Feed/Caching/200RSS2UpdateDate.php +++ b/tests/docroot/Feed/Caching/200UpdateDate.php @@ -1,6 +1,7 @@ 200, 'cache' => false, + 'mime' => "application/rss+xml", 'content' => <<