File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,11 @@ public function toString(): string
61
61
{
62
62
$ value = $ this ->name ;
63
63
if (\count ($ this ->parameters ) > 0 ) {
64
- $ value .= '; ' . \implode ('; ' , $ this ->parameters );
64
+ $ params = [];
65
+ foreach ($ this ->parameters as $ key => $ paramValue ) {
66
+ $ params [] = $ key . '= ' . $ paramValue ;
67
+ }
68
+ $ value .= '; ' . \implode ('; ' , $ params );
65
69
}
66
70
return $ value ;
67
71
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace HttpAccept \Tests \Data ;
4
4
5
+ use Generator ;
5
6
use HttpAccept \Utility \Parser ;
6
7
use PHPUnit \Framework \TestCase ;
7
8
@@ -23,4 +24,18 @@ public function test_parameter_case_insensitive(): void
23
24
24
25
$ this ->assertTrue ($ types [0 ]->hasParamater ('Q ' ));
25
26
}
27
+
28
+ /**
29
+ * @dataProvider toStringDataProvider
30
+ */
31
+ public function test_to_string (string $ source , string $ expected ): void
32
+ {
33
+ $ types = (new Parser ())->parse ($ source );
34
+ $ this ->assertSame ($ expected , $ types [0 ]->toString ());
35
+ }
36
+
37
+ public function toStringDataProvider (): Generator
38
+ {
39
+ yield ['*;version=1.0 ' , '*;version=1.0 ' ];
40
+ }
26
41
}
You can’t perform that action at this time.
0 commit comments