_user_agent; $obj = new StdClass; $obj->agent = new Mock_Libraries_UserAgent(); $this->ci_instance($obj); $this->agent = $obj->agent; } // -------------------------------------------------------------------- public function test_accept_lang() { $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en'; $this->assertTrue($this->agent->accept_lang()); unset($_SERVER['HTTP_ACCEPT_LANGUAGE']); $this->assertTrue($this->agent->accept_lang('en')); $this->assertFalse($this->agent->accept_lang('fr')); } // -------------------------------------------------------------------- public function test_mobile() { // Mobile Not Set $_SERVER['HTTP_USER_AGENT'] = $this->_mobile_ua; $this->assertEquals('', $this->agent->mobile()); unset($_SERVER['HTTP_USER_AGENT']); } // -------------------------------------------------------------------- public function test_util_is_functions() { $this->assertTrue($this->agent->is_browser()); $this->assertFalse($this->agent->is_robot()); $this->assertFalse($this->agent->is_mobile()); $this->assertFalse($this->agent->is_referral()); } // -------------------------------------------------------------------- public function test_agent_string() { $this->assertEquals($this->_user_agent, $this->agent->agent_string()); } // -------------------------------------------------------------------- public function test_browser_info() { $this->assertEquals('Mac OS X', $this->agent->platform()); $this->assertEquals('Safari', $this->agent->browser()); $this->assertEquals('533.20.27', $this->agent->version()); $this->assertEquals('', $this->agent->robot()); $this->assertEquals('', $this->agent->referrer()); } // -------------------------------------------------------------------- public function test_charsets() { $_SERVER['HTTP_ACCEPT_CHARSET'] = 'utf8'; $charsets = $this->agent->charsets(); $this->assertEquals('utf8', $charsets[0]); unset($_SERVER['HTTP_ACCEPT_CHARSET']); $this->assertFalse($this->agent->accept_charset()); } // -------------------------------------------------------------------- }