'order matters when q is equal' =>
['*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7',
['ISO-8859-1', 'utf-8', '*'
]],
'order matters when q is equal2' =>
['*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7',
['utf-8', 'ISO-8859-1', '*'
]],
];
} /**
* @dataProvider provideDefaultValueData
*/
public function testDefaultValue($acceptHeader,
$value,
$expectedQuality) { $header = AcceptHeader::
fromString($acceptHeader);
$this->
assertSame($expectedQuality,
$header->
get($value)->
getQuality());
} public static function provideDefaultValueData() { yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, *;q=0.3', 'text/xml', 0.3
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/xml', 0.3
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/html', 1.0
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/plain', 0.5
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', '*', 0.3
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', '*', 1.0
];
yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/xml', 1.0
];