diff options
author | David King <imkingdavid@gmail.com> | 2013-10-03 09:25:11 -0700 |
---|---|---|
committer | David King <imkingdavid@gmail.com> | 2013-10-03 09:25:11 -0700 |
commit | 2683188206e79c4a5b78ac16ffb43d1d53f3d5ff (patch) | |
tree | 51a821c2097be32b94c7f2c30222b3d1deba7a32 /tests/security/extract_current_page_test.php | |
parent | f2de39f0b4a211510c5bda9cf0b9a211a4ec5cf0 (diff) | |
parent | 51c0aec066a4029f626ee300b3a34a0cc97c6031 (diff) | |
download | forums-2683188206e79c4a5b78ac16ffb43d1d53f3d5ff.tar forums-2683188206e79c4a5b78ac16ffb43d1d53f3d5ff.tar.gz forums-2683188206e79c4a5b78ac16ffb43d1d53f3d5ff.tar.bz2 forums-2683188206e79c4a5b78ac16ffb43d1d53f3d5ff.tar.xz forums-2683188206e79c4a5b78ac16ffb43d1d53f3d5ff.zip |
Merge pull request #1726 from EXreaction/ticket/11850
Fix $user->page on pages through the controller
Diffstat (limited to 'tests/security/extract_current_page_test.php')
-rw-r--r-- | tests/security/extract_current_page_test.php | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php index e42f446b31..1284aab94c 100644 --- a/tests/security/extract_current_page_test.php +++ b/tests/security/extract_current_page_test.php @@ -26,13 +26,23 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base */ public function test_query_string_php_self($url, $query_string, $expected) { - global $request; + global $symfony_request, $request; - $request->merge(\phpbb\request\request_interface::SERVER, array( - 'PHP_SELF' => $url, - 'QUERY_STRING' => $query_string, + $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( + $request, )); - + $symfony_request->expects($this->any()) + ->method('getScriptName') + ->will($this->returnValue($url)); + $symfony_request->expects($this->any()) + ->method('getQueryString') + ->will($this->returnValue($query_string)); + $symfony_request->expects($this->any()) + ->method('getBasePath') + ->will($this->returnValue($server['REQUEST_URI'])); + $symfony_request->expects($this->any()) + ->method('getPathInfo') + ->will($this->returnValue('/')); $result = \phpbb\session::extract_current_page('./'); $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.'; @@ -44,12 +54,23 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base */ public function test_query_string_request_uri($url, $query_string, $expected) { - global $request; + global $symfony_request, $request; - $request->merge(\phpbb\request\request_interface::SERVER, array( - 'PHP_SELF' => $url, - 'QUERY_STRING' => $query_string, + $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array( + $request, )); + $symfony_request->expects($this->any()) + ->method('getScriptName') + ->will($this->returnValue($url)); + $symfony_request->expects($this->any()) + ->method('getQueryString') + ->will($this->returnValue($query_string)); + $symfony_request->expects($this->any()) + ->method('getBasePath') + ->will($this->returnValue($server['REQUEST_URI'])); + $symfony_request->expects($this->any()) + ->method('getPathInfo') + ->will($this->returnValue('/')); $result = \phpbb\session::extract_current_page('./'); @@ -57,4 +78,3 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base $this->assertEquals($expected, $result['query_string'], $label); } } - |