From 9e29235d87e57fdc4ca4a529c0319dacc287cb34 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 8 Jan 2021 16:46:21 -0500 Subject: [PATCH] Don't fetch from example.com during tests --- tests/cases/ImportExport/TestOPML.php | 44 +++++++++---------- tests/docroot/Feed/Caching/200Future.php | 2 +- tests/docroot/Feed/Caching/200Multiple.php | 2 +- tests/docroot/Feed/Caching/200None.php | 2 +- tests/docroot/Feed/Caching/200Past.php | 2 +- tests/docroot/Feed/Caching/200PubDateOnly.php | 2 +- tests/docroot/Feed/Caching/200UpdateDate.php | 2 +- .../Feed/Deduplication/Hashes-Dates1.php | 2 +- .../Feed/Deduplication/Hashes-Dates2.php | 2 +- .../Feed/Deduplication/Hashes-Dates3.php | 2 +- tests/docroot/Feed/Deduplication/Hashes.php | 2 +- tests/docroot/Feed/Deduplication/ID-Dates.php | 2 +- .../Feed/Deduplication/IdenticalHashes.php | 2 +- .../Feed/Deduplication/Permalink-Dates.php | 10 ++--- tests/docroot/Feed/Discovery/Feed.php | 2 +- tests/docroot/Feed/Fetching/TooLarge.php | 2 +- tests/docroot/Feed/Matching/1.php | 2 +- tests/docroot/Feed/Matching/2.php | 2 +- tests/docroot/Feed/Matching/3.php | 2 +- tests/docroot/Feed/Matching/4.php | 2 +- tests/docroot/Feed/Matching/5.php | 2 +- tests/docroot/Feed/NextFetch/1h.php | 2 +- tests/docroot/Feed/NextFetch/3-36h.php | 2 +- tests/docroot/Feed/NextFetch/30m.php | 2 +- tests/docroot/Feed/NextFetch/36h.php | 2 +- tests/docroot/Feed/NextFetch/3h.php | 2 +- tests/docroot/Feed/NextFetch/Fallback.php | 2 +- tests/docroot/Feed/Parsing/Valid.php | 2 +- tests/docroot/Feed/Parsing/XEEAttack.php | 10 ++--- tests/docroot/Feed/Parsing/XXEAttack.php | 10 ++--- tests/docroot/Feed/Scraping/Feed.php | 2 +- tests/docroot/Import/OPML/BrokenOPML.2.opml | 2 +- tests/docroot/Import/OPML/FeedsOnly.opml | 10 ++--- tests/docroot/Import/some-feed.php | 2 +- tests/docroot/index.php | 4 ++ tests/server.php | 3 ++ 36 files changed, 78 insertions(+), 71 deletions(-) create mode 100644 tests/docroot/index.php diff --git a/tests/cases/ImportExport/TestOPML.php b/tests/cases/ImportExport/TestOPML.php index 3c61688..469c674 100644 --- a/tests/cases/ImportExport/TestOPML.php +++ b/tests/cases/ImportExport/TestOPML.php @@ -22,12 +22,12 @@ class TestOPML extends \JKingWeb\Arsse\Test\AbstractTest { ['id' => 1, 'parent' => null, 'children' => 1, 'feeds' => 1, 'name' => "Science"], ]; protected $subscriptions = [ - ['id' => 3, 'folder' => 1, 'top_folder' => 1, 'unread' => 2, 'updated' => "2016-05-23 06:40:02", 'err_msg' => 'argh', 'title' => 'Ars Technica', 'url' => "http://example.com/3", 'favicon' => 'http://example.com/3.png'], - ['id' => 4, 'folder' => 6, 'top_folder' => 3, 'unread' => 6, 'updated' => "2017-10-09 15:58:34", 'err_msg' => '', 'title' => 'CBC News', 'url' => "http://example.com/4", 'favicon' => 'http://example.com/4.png'], - ['id' => 6, 'folder' => null, 'top_folder' => null, 'unread' => 0, 'updated' => "2010-02-12 20:08:47", 'err_msg' => '', 'title' => 'Eurogamer', 'url' => "http://example.com/6", 'favicon' => 'http://example.com/6.png'], - ['id' => 1, 'folder' => 2, 'top_folder' => 1, 'unread' => 5, 'updated' => "2017-09-15 22:54:16", 'err_msg' => '', 'title' => 'NASA JPL', 'url' => "http://example.com/1", 'favicon' => null], - ['id' => 5, 'folder' => 6, 'top_folder' => 3, 'unread' => 12, 'updated' => "2017-07-07 17:07:17", 'err_msg' => '', 'title' => 'Ottawa Citizen', 'url' => "http://example.com/5", 'favicon' => ''], - ['id' => 2, 'folder' => 5, 'top_folder' => 3, 'unread' => 10, 'updated' => "2011-11-11 11:11:11", 'err_msg' => 'oops', 'title' => 'Toronto Star', 'url' => "http://example.com/2", 'favicon' => 'http://example.com/2.png'], + ['id' => 3, 'folder' => 1, 'top_folder' => 1, 'unread' => 2, 'updated' => "2016-05-23 06:40:02", 'err_msg' => 'argh', 'title' => 'Ars Technica', 'url' => "http://localhost:8000/3", 'favicon' => 'http://localhost:8000/3.png'], + ['id' => 4, 'folder' => 6, 'top_folder' => 3, 'unread' => 6, 'updated' => "2017-10-09 15:58:34", 'err_msg' => '', 'title' => 'CBC News', 'url' => "http://localhost:8000/4", 'favicon' => 'http://localhost:8000/4.png'], + ['id' => 6, 'folder' => null, 'top_folder' => null, 'unread' => 0, 'updated' => "2010-02-12 20:08:47", 'err_msg' => '', 'title' => 'Eurogamer', 'url' => "http://localhost:8000/6", 'favicon' => 'http://localhost:8000/6.png'], + ['id' => 1, 'folder' => 2, 'top_folder' => 1, 'unread' => 5, 'updated' => "2017-09-15 22:54:16", 'err_msg' => '', 'title' => 'NASA JPL', 'url' => "http://localhost:8000/1", 'favicon' => null], + ['id' => 5, 'folder' => 6, 'top_folder' => 3, 'unread' => 12, 'updated' => "2017-07-07 17:07:17", 'err_msg' => '', 'title' => 'Ottawa Citizen', 'url' => "http://localhost:8000/5", 'favicon' => ''], + ['id' => 2, 'folder' => 5, 'top_folder' => 3, 'unread' => 10, 'updated' => "2011-11-11 11:11:11", 'err_msg' => 'oops', 'title' => 'Toronto Star', 'url' => "http://localhost:8000/2", 'favicon' => 'http://localhost:8000/2.png'], ]; protected $tags = [ ['id' => 1, 'name' => "Canada", 'subscription' => 2], @@ -47,20 +47,20 @@ class TestOPML extends \JKingWeb\Arsse\Test\AbstractTest { - + - - + + - + - + - + OPML_EXPORT_SERIALIZATION; @@ -69,12 +69,12 @@ OPML_EXPORT_SERIALIZATION; - - - - - - + + + + + + OPML_EXPORT_SERIALIZATION; @@ -129,10 +129,10 @@ OPML_EXPORT_SERIALIZATION; ["Empty.2.opml", false, [[], []]], ["Empty.3.opml", false, [[], []]], ["FeedsOnly.opml", false, [[ - ['url' => "http://example.com/1", 'title' => "Feed 1", 'folder' => 0, 'tags' => []], - ['url' => "http://example.com/2", 'title' => "", 'folder' => 0, 'tags' => []], - ['url' => "http://example.com/3", 'title' => "", 'folder' => 0, 'tags' => []], - ['url' => "http://example.com/4", 'title' => "", 'folder' => 0, 'tags' => []], + ['url' => "http://localhost:8000/1", 'title' => "Feed 1", 'folder' => 0, 'tags' => []], + ['url' => "http://localhost:8000/2", 'title' => "", 'folder' => 0, 'tags' => []], + ['url' => "http://localhost:8000/3", 'title' => "", 'folder' => 0, 'tags' => []], + ['url' => "http://localhost:8000/4", 'title' => "", 'folder' => 0, 'tags' => []], ['url' => "", 'title' => "", 'folder' => 0, 'tags' => ["whee"]], ['url' => "", 'title' => "", 'folder' => 0, 'tags' => ["whee", "whoo"]], ], []]], diff --git a/tests/docroot/Feed/Caching/200Future.php b/tests/docroot/Feed/Caching/200Future.php index ef2ae71..ad43e36 100644 --- a/tests/docroot/Feed/Caching/200Future.php +++ b/tests/docroot/Feed/Caching/200Future.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Caching/200Multiple.php b/tests/docroot/Feed/Caching/200Multiple.php index 583b663..ebbd8a2 100644 --- a/tests/docroot/Feed/Caching/200Multiple.php +++ b/tests/docroot/Feed/Caching/200Multiple.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Caching/200None.php b/tests/docroot/Feed/Caching/200None.php index 562554c..ebe7721 100644 --- a/tests/docroot/Feed/Caching/200None.php +++ b/tests/docroot/Feed/Caching/200None.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Caching/200Past.php b/tests/docroot/Feed/Caching/200Past.php index 361d767..64da54c 100644 --- a/tests/docroot/Feed/Caching/200Past.php +++ b/tests/docroot/Feed/Caching/200Past.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Caching/200PubDateOnly.php b/tests/docroot/Feed/Caching/200PubDateOnly.php index 5b8df9b..93ce637 100644 --- a/tests/docroot/Feed/Caching/200PubDateOnly.php +++ b/tests/docroot/Feed/Caching/200PubDateOnly.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Caching/200UpdateDate.php b/tests/docroot/Feed/Caching/200UpdateDate.php index e7f9a20..3315d28 100644 --- a/tests/docroot/Feed/Caching/200UpdateDate.php +++ b/tests/docroot/Feed/Caching/200UpdateDate.php @@ -6,7 +6,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/Hashes-Dates1.php b/tests/docroot/Feed/Deduplication/Hashes-Dates1.php index 4709e80..8449bee 100644 --- a/tests/docroot/Feed/Deduplication/Hashes-Dates1.php +++ b/tests/docroot/Feed/Deduplication/Hashes-Dates1.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/Hashes-Dates2.php b/tests/docroot/Feed/Deduplication/Hashes-Dates2.php index 321d675..b460c7d 100644 --- a/tests/docroot/Feed/Deduplication/Hashes-Dates2.php +++ b/tests/docroot/Feed/Deduplication/Hashes-Dates2.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/Hashes-Dates3.php b/tests/docroot/Feed/Deduplication/Hashes-Dates3.php index 01d0916..ce95019 100644 --- a/tests/docroot/Feed/Deduplication/Hashes-Dates3.php +++ b/tests/docroot/Feed/Deduplication/Hashes-Dates3.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/Hashes.php b/tests/docroot/Feed/Deduplication/Hashes.php index bc6eaec..2f2a967 100644 --- a/tests/docroot/Feed/Deduplication/Hashes.php +++ b/tests/docroot/Feed/Deduplication/Hashes.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/ID-Dates.php b/tests/docroot/Feed/Deduplication/ID-Dates.php index f26cfc5..90f7026 100644 --- a/tests/docroot/Feed/Deduplication/ID-Dates.php +++ b/tests/docroot/Feed/Deduplication/ID-Dates.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/IdenticalHashes.php b/tests/docroot/Feed/Deduplication/IdenticalHashes.php index 138b7b4..b9e6466 100644 --- a/tests/docroot/Feed/Deduplication/IdenticalHashes.php +++ b/tests/docroot/Feed/Deduplication/IdenticalHashes.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing diff --git a/tests/docroot/Feed/Deduplication/Permalink-Dates.php b/tests/docroot/Feed/Deduplication/Permalink-Dates.php index 304211a..afb9154 100644 --- a/tests/docroot/Feed/Deduplication/Permalink-Dates.php +++ b/tests/docroot/Feed/Deduplication/Permalink-Dates.php @@ -4,29 +4,29 @@ Test feed - http://example.com/ + http://localhost:8000/ A basic feed for testing - http://example.com/1 + http://localhost:8000/1 Sample article 1 Sun, 18 May 1995 15:21:36 GMT 2002-02-19T15:21:36Z - http://example.com/1 + http://localhost:8000/1 Sample article 2 Sun, 19 May 2002 15:21:36 GMT 2002-04-19T15:21:36Z - http://example.com/1 + http://localhost:8000/1 Sample article 3 Sun, 18 May 2000 15:21:36 GMT 1999-05-19T15:21:36Z - http://example.com/2 + http://localhost:8000/2 Sample article 4 Sun, 18 May 2000 15:21:36 GMT 1999-05-19T15:21:36Z diff --git a/tests/docroot/Feed/Discovery/Feed.php b/tests/docroot/Feed/Discovery/Feed.php index a13398a..bb41351 100644 --- a/tests/docroot/Feed/Discovery/Feed.php +++ b/tests/docroot/Feed/Discovery/Feed.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ Example newsfeed title diff --git a/tests/docroot/Feed/Fetching/TooLarge.php b/tests/docroot/Feed/Fetching/TooLarge.php index 0fef567..d13f89c 100644 --- a/tests/docroot/Feed/Fetching/TooLarge.php +++ b/tests/docroot/Feed/Fetching/TooLarge.php @@ -9,7 +9,7 @@ return [ Test feed - http://example.com/ + http://localhost:8000/ Example newsfeed title $item diff --git a/tests/docroot/Feed/Matching/1.php b/tests/docroot/Feed/Matching/1.php index fdc2d67..ef9dfcd 100644 --- a/tests/docroot/Feed/Matching/1.php +++ b/tests/docroot/Feed/Matching/1.php @@ -4,7 +4,7 @@ Example feed title urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 - + urn:uuid:df329114-43df-11e7-9f23-a938604d62f8 diff --git a/tests/docroot/Feed/Matching/2.php b/tests/docroot/Feed/Matching/2.php index b5e2d51..0a4ae55 100644 --- a/tests/docroot/Feed/Matching/2.php +++ b/tests/docroot/Feed/Matching/2.php @@ -4,7 +4,7 @@ Example feed title urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 - + urn:uuid:df329114-43df-11e7-9f23-a938604d62f8 diff --git a/tests/docroot/Feed/Matching/3.php b/tests/docroot/Feed/Matching/3.php index d2c8c0d..665d5d3 100644 --- a/tests/docroot/Feed/Matching/3.php +++ b/tests/docroot/Feed/Matching/3.php @@ -4,7 +4,7 @@ Example feed title urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 - + urn:uuid:df329114-43df-11e7-9f23-a938604d62f8 diff --git a/tests/docroot/Feed/Matching/4.php b/tests/docroot/Feed/Matching/4.php index a68c0e0..5cd9249 100644 --- a/tests/docroot/Feed/Matching/4.php +++ b/tests/docroot/Feed/Matching/4.php @@ -4,7 +4,7 @@ Example feed title urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 - + urn:uuid:df329114-43df-11e7-9f23-a938604d62f8 diff --git a/tests/docroot/Feed/Matching/5.php b/tests/docroot/Feed/Matching/5.php index efb5a9b..de61d76 100644 --- a/tests/docroot/Feed/Matching/5.php +++ b/tests/docroot/Feed/Matching/5.php @@ -4,7 +4,7 @@ Example feed title urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 - + urn:uuid:3d5f5154-43e1-11e7-ba11-1dcae392a974 diff --git a/tests/docroot/Feed/NextFetch/1h.php b/tests/docroot/Feed/NextFetch/1h.php index dd01650..ca9cdac 100644 --- a/tests/docroot/Feed/NextFetch/1h.php +++ b/tests/docroot/Feed/NextFetch/1h.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/NextFetch/3-36h.php b/tests/docroot/Feed/NextFetch/3-36h.php index 41d799f..414d2f0 100644 --- a/tests/docroot/Feed/NextFetch/3-36h.php +++ b/tests/docroot/Feed/NextFetch/3-36h.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/NextFetch/30m.php b/tests/docroot/Feed/NextFetch/30m.php index a7dce24..397871a 100644 --- a/tests/docroot/Feed/NextFetch/30m.php +++ b/tests/docroot/Feed/NextFetch/30m.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/NextFetch/36h.php b/tests/docroot/Feed/NextFetch/36h.php index 359ed9e..251a456 100644 --- a/tests/docroot/Feed/NextFetch/36h.php +++ b/tests/docroot/Feed/NextFetch/36h.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/NextFetch/3h.php b/tests/docroot/Feed/NextFetch/3h.php index e2f5758..dfdd327 100644 --- a/tests/docroot/Feed/NextFetch/3h.php +++ b/tests/docroot/Feed/NextFetch/3h.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/NextFetch/Fallback.php b/tests/docroot/Feed/NextFetch/Fallback.php index 04cc8ac..d127c3a 100644 --- a/tests/docroot/Feed/NextFetch/Fallback.php +++ b/tests/docroot/Feed/NextFetch/Fallback.php @@ -4,7 +4,7 @@ Example title - http://example.com + http://localhost:8000/ Example description diff --git a/tests/docroot/Feed/Parsing/Valid.php b/tests/docroot/Feed/Parsing/Valid.php index f56bd66..ab953fc 100644 --- a/tests/docroot/Feed/Parsing/Valid.php +++ b/tests/docroot/Feed/Parsing/Valid.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ Example newsfeed title diff --git a/tests/docroot/Feed/Parsing/XEEAttack.php b/tests/docroot/Feed/Parsing/XEEAttack.php index 12c4cbf..a4fa7fe 100644 --- a/tests/docroot/Feed/Parsing/XEEAttack.php +++ b/tests/docroot/Feed/Parsing/XEEAttack.php @@ -16,30 +16,30 @@ Test feed - http://example.com/ + http://localhost:8000/ Example newsfeed title urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/1 + http://localhost:8000/1 urn:uuid:4c8dbc84-42eb-11e7-9f61-6f83db96854f urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/1 + http://localhost:8000/1 urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/2 + http://localhost:8000/2 Example title Example content - + diff --git a/tests/docroot/Feed/Parsing/XXEAttack.php b/tests/docroot/Feed/Parsing/XXEAttack.php index 8a38e14..c1c5148 100644 --- a/tests/docroot/Feed/Parsing/XXEAttack.php +++ b/tests/docroot/Feed/Parsing/XXEAttack.php @@ -7,30 +7,30 @@ Test feed - http://example.com/ + http://localhost:8000/ &xxe; urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/1 + http://localhost:8000/1 urn:uuid:4c8dbc84-42eb-11e7-9f61-6f83db96854f urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/1 + http://localhost:8000/1 urn:uuid:43fb1908-42ec-11e7-b61b-2b118faca2f2 - http://example.com/2 + http://localhost:8000/2 Example title Example content - + diff --git a/tests/docroot/Feed/Scraping/Feed.php b/tests/docroot/Feed/Scraping/Feed.php index 71bf40e..514dcfd 100644 --- a/tests/docroot/Feed/Scraping/Feed.php +++ b/tests/docroot/Feed/Scraping/Feed.php @@ -4,7 +4,7 @@ Test feed - http://example.com/ + http://localhost:8000/ Example newsfeed title diff --git a/tests/docroot/Import/OPML/BrokenOPML.2.opml b/tests/docroot/Import/OPML/BrokenOPML.2.opml index ac70153..691c2bd 100644 --- a/tests/docroot/Import/OPML/BrokenOPML.2.opml +++ b/tests/docroot/Import/OPML/BrokenOPML.2.opml @@ -1,2 +1,2 @@ - + diff --git a/tests/docroot/Import/OPML/FeedsOnly.opml b/tests/docroot/Import/OPML/FeedsOnly.opml index 4e68260..88fab76 100644 --- a/tests/docroot/Import/OPML/FeedsOnly.opml +++ b/tests/docroot/Import/OPML/FeedsOnly.opml @@ -1,10 +1,10 @@ - - - - - + + + + + diff --git a/tests/docroot/Import/some-feed.php b/tests/docroot/Import/some-feed.php index eec5856..7f48836 100644 --- a/tests/docroot/Import/some-feed.php +++ b/tests/docroot/Import/some-feed.php @@ -4,7 +4,7 @@ Some feed - http://example.com/ + http://localhost:8000/ Just a generic feed diff --git a/tests/docroot/index.php b/tests/docroot/index.php new file mode 100644 index 0000000..4a6611e --- /dev/null +++ b/tests/docroot/index.php @@ -0,0 +1,4 @@ + 204, + 'content' => "", +]; diff --git a/tests/server.php b/tests/server.php index 2d738c9..2e7d8d4 100644 --- a/tests/server.php +++ b/tests/server.php @@ -41,6 +41,9 @@ $defaults = [ // default values for response ]; $url = explode("?", $_SERVER['REQUEST_URI'])[0]; +if ($url === "/") { + $url = "/index"; +} $base = BASE."tests".\DIRECTORY_SEPARATOR."docroot"; $test = $base.str_replace("/", \DIRECTORY_SEPARATOR, $url).".php"; if (!file_exists($test)) {