Ejemplo n.º 1
0
 public function testGetAcceptedContentTypes()
 {
     $this->assertSame(array(), $this->request->getAcceptedContentTypes(), 'Request without an accept setHeader should return an empty array');
     $request = $this->getRequest(array('HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'));
     $expected = array(array('type' => 'text', 'subType' => 'html', 'mimeType' => 'text/html', 'original' => 'text/html', 'params' => array('q' => 1.0)), array('type' => 'application', 'subType' => 'xhtml+xml', 'mimeType' => 'application/xhtml+xml', 'original' => 'application/xhtml+xml', 'params' => array('q' => 1.0)), array('type' => 'application', 'subType' => 'xml', 'mimeType' => 'application/xml', 'original' => 'application/xml;q=0.9', 'params' => array('q' => 0.9)), array('type' => '*', 'subType' => '*', 'mimeType' => '*/*', 'original' => '*/*;q=0.8', 'params' => array('q' => 0.8)));
     $this->assertEquals($expected, $request->getAcceptedContentTypes());
     $request = $this->getRequest(array('HTTP_ACCEPT' => ',text/html;q=0.6;level=1;test'));
     $expected = array(array('type' => 'text', 'subType' => 'html', 'mimeType' => 'text/html', 'original' => 'text/html;q=0.6;level=1;test', 'params' => array('q' => 0.6, 'level' => 1)));
     $this->assertEquals($expected, $request->getAcceptedContentTypes());
 }