aboutsummaryrefslogtreecommitdiffstats
path: root/tests/request
diff options
context:
space:
mode:
Diffstat (limited to 'tests/request')
-rw-r--r--tests/request/request_test.php15
-rw-r--r--tests/request/type_cast_helper_test.php10
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/request/request_test.php b/tests/request/request_test.php
index 203c9fd880..9999e88121 100644
--- a/tests/request/request_test.php
+++ b/tests/request/request_test.php
@@ -23,7 +23,6 @@ class phpbb_request_test extends phpbb_test_case
$_GET['unset'] = '';
$this->type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface');
-
$this->request = new phpbb_request($this->type_cast_helper);
}
@@ -60,6 +59,20 @@ class phpbb_request_test extends phpbb_test_case
$this->assertFalse($this->request->is_set_post('unset'));
}
+ public function test_is_ajax_without_ajax()
+ {
+ $this->assertFalse($this->request->is_ajax());
+ }
+
+ public function test_is_ajax_with_ajax()
+ {
+ $this->request->enable_super_globals();
+ $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
+ $this->request = new phpbb_request($this->type_cast_helper);
+
+ $this->assertTrue($this->request->is_ajax());
+ }
+
public function test_variable_names()
{
$expected = array('test', 'unset');
diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php
index 06cf2e1bf6..0103c51561 100644
--- a/tests/request/type_cast_helper_test.php
+++ b/tests/request/type_cast_helper_test.php
@@ -48,4 +48,14 @@ class phpbb_type_cast_helper_test extends phpbb_test_case
$this->assertEquals($expected, $data);
}
+
+ public function test_simple_set_var_without_html_encoding()
+ {
+ $data = 'eviL<3';
+ $expected = 'eviL<3';
+
+ $this->type_cast_helper->recursive_set_var($data, '', true, false);
+
+ $this->assertEquals($expected, $data);
+ }
}