From 8d14729797045fee9e75ab5e11fe4999c2504956 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sat, 13 Jun 2020 10:34:13 -0400 Subject: [PATCH] Re-organize parser tests --- tests/cases/{ => Parser}/AbstractParserTestCase.php | 2 +- tests/cases/{ => Parser}/HTTP/http.yaml | 0 tests/cases/{HTTP => Parser}/HTTPTest.php | 6 +++--- tests/cases/{ => Parser}/JSON/entry.yaml | 0 tests/cases/{ => Parser}/JSON/failures.yaml | 0 tests/cases/{ => Parser}/JSON/feed.yaml | 0 tests/cases/{JSON => Parser}/JSONTest.php | 6 +++--- tests/cases/{ => Parser}/XML/entry-atom.yaml | 0 tests/cases/{ => Parser}/XML/entry-mixed.yaml | 0 tests/cases/{ => Parser}/XML/entry-other.yaml | 0 tests/cases/{ => Parser}/XML/entry-rss1.yaml | 0 tests/cases/{ => Parser}/XML/entry-rss2.yaml | 0 tests/cases/{ => Parser}/XML/failures.yaml | 0 tests/cases/{ => Parser}/XML/feed-atom.yaml | 0 tests/cases/{ => Parser}/XML/feed-mixed.yaml | 0 tests/cases/{ => Parser}/XML/feed-other.yaml | 0 tests/cases/{ => Parser}/XML/feed-rss0.yaml | 0 tests/cases/{ => Parser}/XML/feed-rss1.yaml | 0 tests/cases/{ => Parser}/XML/feed-rss2.yaml | 0 tests/cases/{XML => Parser}/XMLTest.php | 6 +++--- tests/phpunit.dist.xml | 10 ++-------- 21 files changed, 12 insertions(+), 18 deletions(-) rename tests/cases/{ => Parser}/AbstractParserTestCase.php (99%) rename tests/cases/{ => Parser}/HTTP/http.yaml (100%) rename tests/cases/{HTTP => Parser}/HTTPTest.php (80%) rename tests/cases/{ => Parser}/JSON/entry.yaml (100%) rename tests/cases/{ => Parser}/JSON/failures.yaml (100%) rename tests/cases/{ => Parser}/JSON/feed.yaml (100%) rename tests/cases/{JSON => Parser}/JSONTest.php (81%) rename tests/cases/{ => Parser}/XML/entry-atom.yaml (100%) rename tests/cases/{ => Parser}/XML/entry-mixed.yaml (100%) rename tests/cases/{ => Parser}/XML/entry-other.yaml (100%) rename tests/cases/{ => Parser}/XML/entry-rss1.yaml (100%) rename tests/cases/{ => Parser}/XML/entry-rss2.yaml (100%) rename tests/cases/{ => Parser}/XML/failures.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-atom.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-mixed.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-other.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-rss0.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-rss1.yaml (100%) rename tests/cases/{ => Parser}/XML/feed-rss2.yaml (100%) rename tests/cases/{XML => Parser}/XMLTest.php (81%) diff --git a/tests/cases/AbstractParserTestCase.php b/tests/cases/Parser/AbstractParserTestCase.php similarity index 99% rename from tests/cases/AbstractParserTestCase.php rename to tests/cases/Parser/AbstractParserTestCase.php index 419633e..8cc8128 100644 --- a/tests/cases/AbstractParserTestCase.php +++ b/tests/cases/Parser/AbstractParserTestCase.php @@ -4,7 +4,7 @@ * See LICENSE and AUTHORS files for details */ declare(strict_types=1); -namespace MensBeam\Lax\TestCase; +namespace MensBeam\Lax\TestCase\Parser; use MensBeam\Lax\Feed; use MensBeam\Lax\Date; diff --git a/tests/cases/HTTP/http.yaml b/tests/cases/Parser/HTTP/http.yaml similarity index 100% rename from tests/cases/HTTP/http.yaml rename to tests/cases/Parser/HTTP/http.yaml diff --git a/tests/cases/HTTP/HTTPTest.php b/tests/cases/Parser/HTTPTest.php similarity index 80% rename from tests/cases/HTTP/HTTPTest.php rename to tests/cases/Parser/HTTPTest.php index c55fca1..81609c7 100644 --- a/tests/cases/HTTP/HTTPTest.php +++ b/tests/cases/Parser/HTTPTest.php @@ -4,12 +4,12 @@ * See LICENSE and AUTHORS files for details */ declare(strict_types=1); -namespace MensBeam\Lax\TestCase\JSON; +namespace MensBeam\Lax\TestCase\Parser; use GuzzleHttp\Psr7\Response; /** @covers MensBeam\Lax\Parser\HTTP\Message */ -class HTTPTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { +class HTTPTest extends AbstractParserTestCase { /** @dataProvider provideHTTPMessages */ public function testParseAnHttpMessage(Response $input, ?string $url, $exp): void { $p = new \MensBeam\Lax\Parser\HTTP\Message($input, $url); @@ -23,7 +23,7 @@ class HTTPTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { } public function provideHTTPMessages(): iterable { - foreach ($this->provideParserTests(__DIR__."/*.yaml") as $k => $t) { + foreach ($this->provideParserTests(__DIR__."/HTTP/*.yaml") as $k => $t) { array_splice($t, 1, 1); yield $k => $t; } diff --git a/tests/cases/JSON/entry.yaml b/tests/cases/Parser/JSON/entry.yaml similarity index 100% rename from tests/cases/JSON/entry.yaml rename to tests/cases/Parser/JSON/entry.yaml diff --git a/tests/cases/JSON/failures.yaml b/tests/cases/Parser/JSON/failures.yaml similarity index 100% rename from tests/cases/JSON/failures.yaml rename to tests/cases/Parser/JSON/failures.yaml diff --git a/tests/cases/JSON/feed.yaml b/tests/cases/Parser/JSON/feed.yaml similarity index 100% rename from tests/cases/JSON/feed.yaml rename to tests/cases/Parser/JSON/feed.yaml diff --git a/tests/cases/JSON/JSONTest.php b/tests/cases/Parser/JSONTest.php similarity index 81% rename from tests/cases/JSON/JSONTest.php rename to tests/cases/Parser/JSONTest.php index 6d1bcf9..c2e987a 100644 --- a/tests/cases/JSON/JSONTest.php +++ b/tests/cases/Parser/JSONTest.php @@ -4,13 +4,13 @@ * See LICENSE and AUTHORS files for details */ declare(strict_types=1); -namespace MensBeam\Lax\TestCase\JSON; +namespace MensBeam\Lax\TestCase\Parser; /** * @covers MensBeam\Lax\Parser\JSON\Feed * @covers MensBeam\Lax\Parser\JSON\Entry */ -class JSONTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { +class JSONTest extends AbstractParserTestCase { /** @dataProvider provideJSONFeed */ public function testParseAJsonFeed(string $input, string $type, ?string $url, $exp): void { $p = new \MensBeam\Lax\Parser\JSON\Feed($input, $type, $url); @@ -24,6 +24,6 @@ class JSONTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { } public function provideJSONFeed(): iterable { - return $this->provideParserTests(__DIR__."/*.yaml"); + return $this->provideParserTests(__DIR__."/JSON/*.yaml"); } } diff --git a/tests/cases/XML/entry-atom.yaml b/tests/cases/Parser/XML/entry-atom.yaml similarity index 100% rename from tests/cases/XML/entry-atom.yaml rename to tests/cases/Parser/XML/entry-atom.yaml diff --git a/tests/cases/XML/entry-mixed.yaml b/tests/cases/Parser/XML/entry-mixed.yaml similarity index 100% rename from tests/cases/XML/entry-mixed.yaml rename to tests/cases/Parser/XML/entry-mixed.yaml diff --git a/tests/cases/XML/entry-other.yaml b/tests/cases/Parser/XML/entry-other.yaml similarity index 100% rename from tests/cases/XML/entry-other.yaml rename to tests/cases/Parser/XML/entry-other.yaml diff --git a/tests/cases/XML/entry-rss1.yaml b/tests/cases/Parser/XML/entry-rss1.yaml similarity index 100% rename from tests/cases/XML/entry-rss1.yaml rename to tests/cases/Parser/XML/entry-rss1.yaml diff --git a/tests/cases/XML/entry-rss2.yaml b/tests/cases/Parser/XML/entry-rss2.yaml similarity index 100% rename from tests/cases/XML/entry-rss2.yaml rename to tests/cases/Parser/XML/entry-rss2.yaml diff --git a/tests/cases/XML/failures.yaml b/tests/cases/Parser/XML/failures.yaml similarity index 100% rename from tests/cases/XML/failures.yaml rename to tests/cases/Parser/XML/failures.yaml diff --git a/tests/cases/XML/feed-atom.yaml b/tests/cases/Parser/XML/feed-atom.yaml similarity index 100% rename from tests/cases/XML/feed-atom.yaml rename to tests/cases/Parser/XML/feed-atom.yaml diff --git a/tests/cases/XML/feed-mixed.yaml b/tests/cases/Parser/XML/feed-mixed.yaml similarity index 100% rename from tests/cases/XML/feed-mixed.yaml rename to tests/cases/Parser/XML/feed-mixed.yaml diff --git a/tests/cases/XML/feed-other.yaml b/tests/cases/Parser/XML/feed-other.yaml similarity index 100% rename from tests/cases/XML/feed-other.yaml rename to tests/cases/Parser/XML/feed-other.yaml diff --git a/tests/cases/XML/feed-rss0.yaml b/tests/cases/Parser/XML/feed-rss0.yaml similarity index 100% rename from tests/cases/XML/feed-rss0.yaml rename to tests/cases/Parser/XML/feed-rss0.yaml diff --git a/tests/cases/XML/feed-rss1.yaml b/tests/cases/Parser/XML/feed-rss1.yaml similarity index 100% rename from tests/cases/XML/feed-rss1.yaml rename to tests/cases/Parser/XML/feed-rss1.yaml diff --git a/tests/cases/XML/feed-rss2.yaml b/tests/cases/Parser/XML/feed-rss2.yaml similarity index 100% rename from tests/cases/XML/feed-rss2.yaml rename to tests/cases/Parser/XML/feed-rss2.yaml diff --git a/tests/cases/XML/XMLTest.php b/tests/cases/Parser/XMLTest.php similarity index 81% rename from tests/cases/XML/XMLTest.php rename to tests/cases/Parser/XMLTest.php index 5958f63..f6b0a9b 100644 --- a/tests/cases/XML/XMLTest.php +++ b/tests/cases/Parser/XMLTest.php @@ -4,14 +4,14 @@ * See LICENSE and AUTHORS files for details */ declare(strict_types=1); -namespace MensBeam\Lax\TestCase\XML; +namespace MensBeam\Lax\TestCase\Parser; /** * @covers MensBeam\Lax\Parser\XML\Feed * @covers MensBeam\Lax\Parser\XML\Entry * @covers MensBeam\Lax\Parser\XML\XPath */ -class XMLTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { +class XMLTest extends AbstractParserTestCase { /** @dataProvider provideXML */ public function testParseAnXmlFeed(string $input, string $type, ?string $url, $exp): void { $p = new \MensBeam\Lax\Parser\XML\Feed($input, $type, $url); @@ -25,6 +25,6 @@ class XMLTest extends \MensBeam\Lax\TestCase\AbstractParserTestCase { } public function provideXML(): iterable { - return $this->provideParserTests(__DIR__."/*.yaml"); + return $this->provideParserTests(__DIR__."/XML/*.yaml"); } } diff --git a/tests/phpunit.dist.xml b/tests/phpunit.dist.xml index c79b603..62adf57 100644 --- a/tests/phpunit.dist.xml +++ b/tests/phpunit.dist.xml @@ -22,14 +22,8 @@ cases/Util - - cases/JSON - - - cases/XML - - - cases/HTTP + + cases/Parser