Browse Source

Update standard tests

master
J. King 4 years ago
parent
commit
7f8d39b6a5
  1. 6
      tests/cases/MimeTypeTest.php
  2. 7
      tests/cases/README
  3. 0
      tests/cases/generated-mime-types.json
  4. 2
      tests/cases/mime-groups.json
  5. 0
      tests/cases/mime-types.json

6
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) {

7
tests/cases/std/README → 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
<https://github.com/web-platform-tests/wpt/tree/62317fb983ca5687e4133d89f5523839fdab7f69/mimesniff/mime-types>
<https://github.com/web-platform-tests/wpt/tree/5c417eadfaa7ff328eb1cbc6338b843d73de4f63/mimesniff/mime-types>
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

0
tests/cases/std/generated-mime-types.json → tests/cases/generated-mime-types.json

2
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"]},

0
tests/cases/std/mime-types.json → tests/cases/mime-types.json

Loading…
Cancel
Save