summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/libraries')
-rw-r--r--tests/codeigniter/libraries/User_agent_test.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/codeigniter/libraries/User_agent_test.php b/tests/codeigniter/libraries/User_agent_test.php
index 277c12ed0..6f9e87196 100644
--- a/tests/codeigniter/libraries/User_agent_test.php
+++ b/tests/codeigniter/libraries/User_agent_test.php
@@ -8,17 +8,17 @@ class UserAgent_test extends CI_TestCase
{
protected $_user_agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27';
protected $_mobile_ua = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7';
-
+
public function set_up()
{
// set a baseline user agent
$_SERVER['HTTP_USER_AGENT'] = $this->_user_agent;
-
+
$obj = new StdClass;
$obj->agent = new CI_User_agent();
-
+
$this->ci_instance($obj);
-
+
$this->agent = $obj->agent;
}
@@ -27,10 +27,10 @@ class UserAgent_test extends CI_TestCase
public function test_accept_lang()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en';
-
- $this->assertEquals('en', $this->agent->accept_lang());
-
+ $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'));
}
// --------------------------------------------------------------------
@@ -70,19 +70,19 @@ class UserAgent_test extends CI_TestCase
$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());
}