1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2025-01-03 14:32:40 +00:00

Last cache-handling Feed test

This commit is contained in:
J. King 2017-05-22 17:06:01 -04:00
parent ed3e3c12d6
commit 148875c0dd
7 changed files with 37 additions and 3 deletions

View file

@ -53,12 +53,17 @@ class TestFeed extends \PHPUnit\Framework\TestCase {
$this->assertNotEmpty($f->resource->getETag()); $this->assertNotEmpty($f->resource->getETag());
// these tests have no HTTP headers and rely on article dates // these tests have no HTTP headers and rely on article dates
$t = strtotime("2002-05-19T15:21:36Z"); $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); $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); $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->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() { function testComputeNextFetchOnError() {

View file

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

View file

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

View file

@ -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
];

View file

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

View file

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

View file

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