diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-06-30 01:34:21 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-06-30 01:34:21 +0200 |
commit | 4d053d04448a73826574eeb5e6be7e4d53c38ae6 (patch) | |
tree | 2e5c3af398d4da0df023f14c2bf4793439a1a9e0 | |
parent | 9e777cee116bd29c51b62ccd1c4353cc00014522 (diff) | |
download | rpg-4d053d04448a73826574eeb5e6be7e4d53c38ae6.tar.gz rpg-4d053d04448a73826574eeb5e6be7e4d53c38ae6.tar.bz2 |
moved URI setup to execute()
-rw-r--r-- | _test/core/TestRequest.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/_test/core/TestRequest.php b/_test/core/TestRequest.php index aeda4b892..172821576 100644 --- a/_test/core/TestRequest.php +++ b/_test/core/TestRequest.php @@ -36,9 +36,10 @@ class TestRequest { /** * Executes the request * + * @param string $url end URL to simulate, needs to start with /doku.php currently * @return TestResponse the resulting output of the request */ - public function execute() { + public function execute($uri='/doku.php') { // save old environment $server = $_SERVER; $session = $_SESSION; @@ -46,6 +47,9 @@ class TestRequest { $post = $_POST; $request = $_REQUEST; + // prepare the right URI + $this->setUri($uri); + // import all defined globals into the function scope foreach(array_keys($GLOBALS) as $glb){ global $$glb; @@ -95,8 +99,9 @@ class TestRequest { * with all set GET variables. * * @param string $url end URL to simulate, needs to start with /doku.php currently + * @todo make this work with other end points */ - public function setUri($uri){ + protected function setUri($uri){ if(substr($uri,0,9) != '/doku.php'){ throw new Exception("only '/doku.php' is supported currently"); } @@ -128,10 +133,9 @@ class TestRequest { * @param return TestResponse */ public function post($post=array(), $uri='/doku.php') { - $this->setUri($uri); $this->post = array_merge($this->post, $post); $this->setServer('REQUEST_METHOD', 'POST'); - return $this->execute(); + return $this->execute($uri); } /** @@ -143,9 +147,8 @@ class TestRequest { */ public function get($get=array(), $uri='/doku.php') { $this->get = array_merge($this->get, $get); - $this->setUri($uri); $this->setServer('REQUEST_METHOD', 'GET'); - return $this->execute(); + return $this->execute($uri); } |