/** * Headers should be reset when you use setHttpHeaders. * @covers Agent::setHttpHeaders * @issue #144 */ public function testSetHttpHeaders() { $header1 = array('HTTP_PINK_PONY' => 'I secretly love ponies >_>'); $md = new Agent($header1); $this->assertSame($md->getHttpHeaders(), $header1); $header2 = array('HTTP_FIRE_BREATHING_DRAGON' => 'yeah!'); $md->setHttpHeaders($header2); $this->assertSame($md->getHttpHeaders(), $header2); }
public function testLanguages() { $agent = new Agent(); $agent->setHttpHeaders(array('HTTP_ACCEPT_LANGUAGE' => 'nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4')); $this->assertEquals(array('nl-nl', 'nl', 'en-us', 'en'), $agent->languages()); }
/** * Set the HTTP Headers. Must be PHP-flavored. This method will reset existing headers. * * @param array $httpHeaders The headers to set. If null, then using PHP's _SERVER to extract * the headers. The default null is left for backwards compatibilty. * @static */ public static function setHttpHeaders($httpHeaders = null) { //Method inherited from \Mobile_Detect return \Jenssegers\Agent\Agent::setHttpHeaders($httpHeaders); }