From 7f8d39b6a505842dd70ba50e0fbfa9408fc2f65e Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 20 Apr 2020 15:32:13 -0400 Subject: [PATCH] Update standard tests --- tests/cases/MimeTypeTest.php | 6 +++--- tests/cases/{std => }/README | 7 +++---- tests/cases/{std => }/generated-mime-types.json | 0 tests/cases/mime-groups.json | 2 +- tests/cases/{std => }/mime-types.json | 0 5 files changed, 7 insertions(+), 8 deletions(-) rename tests/cases/{std => }/README (83%) rename tests/cases/{std => }/generated-mime-types.json (100%) rename tests/cases/{std => }/mime-types.json (100%) diff --git a/tests/cases/MimeTypeTest.php b/tests/cases/MimeTypeTest.php index 96262ed..d126c34 100644 --- a/tests/cases/MimeTypeTest.php +++ b/tests/cases/MimeTypeTest.php @@ -10,7 +10,7 @@ use MensBeam\Mime\MimeType as Mime; /** @covers \MensBeam\Mime\MimeType */ class MimeTypeTest extends \PHPUnit\Framework\TestCase { - /** @dataProvider provideStandardTests */ + /** @dataProvider provideStandardParsingTests */ public function testStandardTestSuite(string $input, ?string $exp): void { if (is_null($exp)) { $this->assertNull(Mime::parse($input)); @@ -19,8 +19,8 @@ class MimeTypeTest extends \PHPUnit\Framework\TestCase { } } - public function provideStandardTests(): iterable { - foreach (new \GlobIterator(__DIR__."/std/*.json", \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::KEY_AS_FILENAME) as $file => $path) { + public function provideStandardParsingTests(): iterable { + foreach (new \GlobIterator(__DIR__."/*mime-types.json", \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::KEY_AS_FILENAME) as $file => $path) { $indexOffset = 0; $description = ""; foreach (json_decode(file_get_contents($path)) as $index => $test) { diff --git a/tests/cases/std/README b/tests/cases/README similarity index 83% rename from tests/cases/std/README rename to tests/cases/README index 7e947ff..6f969ee 100644 --- a/tests/cases/std/README +++ b/tests/cases/README @@ -2,11 +2,10 @@ The MimeType class is an original work, but its test suite is derived in part from an existing test corpus from the following source: The Web Platform Test suite - + -The license text is reproduced below, but please note that the license text -has changed since the last time the mimesniff portion of the test suite was -modified; the text included here is current as of 2019-04-25. +The license text is reproduced below. As a note of historical interest, +the mime-groups.json file originated as tests for this library. Copyright 2019 web-platform-tests contributors diff --git a/tests/cases/std/generated-mime-types.json b/tests/cases/generated-mime-types.json similarity index 100% rename from tests/cases/std/generated-mime-types.json rename to tests/cases/generated-mime-types.json diff --git a/tests/cases/mime-groups.json b/tests/cases/mime-groups.json index 7af21ea..1b5d7d5 100644 --- a/tests/cases/mime-groups.json +++ b/tests/cases/mime-groups.json @@ -43,7 +43,7 @@ "HTML is scriptable", {"input": "text/html", "groups": ["HTML", "scriptable"]}, {"input": "text/html;x=x", "groups": ["HTML", "scriptable"]}, - "PDF is scriptable", + "PDF is scriptable", {"input": "application/pdf", "groups": ["scriptable"]}, {"input": "application/pdf;x=x", "groups": ["scriptable"]}, {"input": "application/ecmascript", "groups": ["JavaScript"]}, diff --git a/tests/cases/std/mime-types.json b/tests/cases/mime-types.json similarity index 100% rename from tests/cases/std/mime-types.json rename to tests/cases/mime-types.json