Browse Source

Last cache-handling Feed test

microsub
J. King 7 years ago
parent
commit
148875c0dd
  1. 11
      tests/Feed/TestFeed.php
  2. 1
      tests/docroot/Feed/Caching/200Future.php
  3. 1
      tests/docroot/Feed/Caching/200Multiple.php
  4. 24
      tests/docroot/Feed/Caching/200None.php
  5. 1
      tests/docroot/Feed/Caching/200Past.php
  6. 1
      tests/docroot/Feed/Caching/200PubDateOnly.php
  7. 1
      tests/docroot/Feed/Caching/200UpdateDate.php

11
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() {

1
tests/docroot/Feed/Caching/200Future.php

@ -1,5 +1,6 @@
<?php return [
'code' => 200,
'mime' => "application/rss+xml",
'lastMod' => time() + 2000,
'content' => <<<MESSAGE_BODY
<rss version="2.0">

1
tests/docroot/Feed/Caching/200RSS2Multiple.php → tests/docroot/Feed/Caching/200Multiple.php

@ -1,6 +1,7 @@
<?php return [
'code' => 200,
'cache' => false,
'mime' => "application/rss+xml",
'content' => <<<MESSAGE_BODY
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>

24
tests/docroot/Feed/Caching/200None.php

@ -0,0 +1,24 @@
<?php return [
'code' => 200,
'cache' => false,
'mime' => "application/rss+xml",
'content' => <<<MESSAGE_BODY
<rss version="2.0">
<channel>
<title>Test feed</title>
<link>http://example.com/</link>
<description>A basic feed for testing</description>
<item>
<description>Sample article 1</description>
</item>
<item>
<description>Sample article 2</description>
</item>
<item>
<description>Sample article 3</description>
</item>
</channel>
</rss>
MESSAGE_BODY
];

1
tests/docroot/Feed/Caching/200Past.php

@ -1,6 +1,7 @@
<?php return [
'code' => 200,
'lastMod' => time() - 2000,
'mime' => "application/rss+xml",
'content' => <<<MESSAGE_BODY
<rss version="2.0">
<channel>

1
tests/docroot/Feed/Caching/200RSS2PubDateOnly.php → tests/docroot/Feed/Caching/200PubDateOnly.php

@ -1,6 +1,7 @@
<?php return [
'code' => 200,
'cache' => false,
'mime' => "application/rss+xml",
'content' => <<<MESSAGE_BODY
<rss version="2.0">
<channel>

1
tests/docroot/Feed/Caching/200RSS2UpdateDate.php → tests/docroot/Feed/Caching/200UpdateDate.php

@ -1,6 +1,7 @@
<?php return [
'code' => 200,
'cache' => false,
'mime' => "application/rss+xml",
'content' => <<<MESSAGE_BODY
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
Loading…
Cancel
Save