File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ final class ItemTest extends StructuredFieldTest
16
16
__DIR__ .'/../vendor/httpwg/structured-field-tests/number-generated.json ' ,
17
17
__DIR__ .'/../vendor/httpwg/structured-field-tests/string.json ' ,
18
18
__DIR__ .'/../vendor/httpwg/structured-field-tests/string-generated.json ' ,
19
+ __DIR__ .'/../vendor/httpwg/structured-field-tests/token.json ' ,
20
+ __DIR__ .'/../vendor/httpwg/structured-field-tests/token-generated.json ' ,
19
21
__DIR__ .'/../vendor/httpwg/structured-field-tests/item.json ' ,
20
22
];
21
23
Original file line number Diff line number Diff line change 4
4
5
5
namespace Bakame \Http \StructuredFields ;
6
6
7
+ use PHPUnit \Framework \TestCase ;
7
8
use function var_export ;
8
9
9
10
/**
10
11
* @coversDefaultClass \Bakame\Http\StructuredFields\Token
11
12
*/
12
- final class TokenTest extends StructuredFieldTest
13
+ final class TokenTest extends TestCase
13
14
{
14
- /** @var array|string[] */
15
- protected array $ paths = [
16
- __DIR__ .'/../vendor/httpwg/structured-field-tests/token.json ' ,
17
- __DIR__ .'/../vendor/httpwg/structured-field-tests/token-generated.json ' ,
18
- ];
19
-
20
15
/**
21
16
* @test
17
+ * @dataProvider invalidTokenString
22
18
*/
23
- public function it_will_fail_on_invalid_token_string (): void
19
+ public function it_will_fail_on_invalid_token_string (string $ httpValue ): void
24
20
{
25
21
$ this ->expectException (SyntaxError::class);
26
22
27
- Token::fromString ('a a ' );
23
+ Token::fromString ($ httpValue );
24
+ }
25
+
26
+ /**
27
+ * @return array<array{0:string}>
28
+ */
29
+ public function invalidTokenString (): array
30
+ {
31
+ return [
32
+ ['a a ' ],
33
+ ["a \u 0001a " ],
34
+ ['3a ' ],
35
+ ['a"a ' ],
36
+ ['a,a ' ],
37
+ ];
28
38
}
29
39
30
40
/**
You can’t perform that action at this time.
0 commit comments