コード例 #1
0
 /**
  * @covers Xoops\Core\HttpRequest::clientAcceptsType
  * @todo   Implement testAccepts().
  */
 public function testClientAcceptsType()
 {
     $_SERVER['HTTP_ACCEPT'] = 'text/html,application/xml;q=0.9,image/webp';
     $this->assertTrue($this->object->clientAcceptsType('text/html'));
     $this->assertTrue($this->object->clientAcceptsType('application/xml'));
     $this->assertTrue($this->object->clientAcceptsType('image/webp'));
     $this->assertFalse($this->object->clientAcceptsType('image/jpeg'));
     $_SERVER['HTTP_ACCEPT'] = 'text/html,application/xml;q=0.9,image/*';
     $this->assertTrue($this->object->clientAcceptsType('image/webp'));
     $this->assertTrue($this->object->clientAcceptsType('image/jpeg'));
     $this->assertFalse($this->object->clientAcceptsType('application/shockwave'));
     $_SERVER['HTTP_ACCEPT'] = 'text/html,application/xml;q=0.9,*/*;q=0.1';
     $this->assertTrue($this->object->clientAcceptsType('application/shockwave'));
 }