14 use PHPUnit\Framework\TestCase;
23 $this->assertSame(
'text/html', $header->first()->getValue());
32 $parsed = array_values($header->all());
34 foreach ($parsed as $item) {
37 $this->assertEquals($items, $parsed);
47 array(
'"this;should,not=matter"', array(
new AcceptHeaderItem(
'this;should,not=matter'))),
57 $this->assertEquals($string, (
string) $header);
66 array(array(
new AcceptHeaderItem(
'this;should,not=matter')),
'this;should,not=matter'),
73 public function testFilter($string, $filter, array $values)
76 $this->assertEquals($values, array_keys($header->all()));
82 array(
'fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4',
'/fr.*/', array(
'fr-FR',
'fr')),
92 $this->assertEquals($values, array_keys($header->all()));
98 'quality has priority' => array(
'*;q=0.3,ISO-8859-1,utf-8;q=0.7', array(
'ISO-8859-1',
'utf-8',
'*')),
99 'order matters when q is equal' => array(
'*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array(
'ISO-8859-1',
'utf-8',
'*')),
100 'order matters when q is equal2' => array(
'*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array(
'utf-8',
'ISO-8859-1',
'*')),