diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-19 11:49:13 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-19 11:49:13 -0500 |
commit | 2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e (patch) | |
tree | 914249f2e1d6d4e28a073d20f898a03aaa69f5f8 /tests/security/extract_current_page_test.php | |
parent | d85ae0f7bc0bd9663eda83c6713f0ef71289b0f4 (diff) | |
download | forums-2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e.tar forums-2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e.tar.gz forums-2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e.tar.bz2 forums-2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e.tar.xz forums-2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e.zip |
[ticket/11850] Fix extract current page test
PHPBB3-11850
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 d77cbbcaf3..2c69e7955b 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_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_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); } } - |