From fe717f57f7a1c262eb6104ccb575ee3294712afa Mon Sep 17 00:00:00 2001 From: lisps Date: Tue, 4 Feb 2014 10:59:06 +0100 Subject: fix content check test cases add test case new Input check add global variables to execute --- _test/core/TestRequest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to '_test/core') diff --git a/_test/core/TestRequest.php b/_test/core/TestRequest.php index 0a54910ed..060e37d28 100644 --- a/_test/core/TestRequest.php +++ b/_test/core/TestRequest.php @@ -44,13 +44,18 @@ class TestRequest { * @return TestResponse the resulting output of the request */ public function execute($uri='/doku.php') { + global $INPUT; + global $ID; + global $INFO; + // save old environment $server = $_SERVER; $session = $_SESSION; $get = $_GET; $post = $_POST; $request = $_REQUEST; - + $input = $INPUT; + // prepare the right URI $this->setUri($uri); @@ -74,6 +79,7 @@ class TestRequest { // now execute dokuwiki and grep the output header_remove(); ob_start('ob_start_callback'); + $INPUT = new Input(); include(DOKU_INC.$this->script); ob_end_flush(); @@ -89,6 +95,7 @@ class TestRequest { $_GET = $get; $_POST = $post; $_REQUEST = $request; + $INPUT = $input; return $response; } -- cgit v1.2.3 From c01cdb709fd0bf8c91333c5134743e33bf587833 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Thu, 6 Mar 2014 19:58:09 +0000 Subject: Fix unittests broken by previous two commits Mostly this is for unit tests which use of \$_SERVER['REMOTE_USER'] It ensures the reference/alias connection between \$INPUT->server and \$_SERVER is renewed before each test. Tests using TestRequest class will replace this \$INPUT with their own. --- _test/core/DokuWikiTest.php | 3 +++ 1 file changed, 3 insertions(+) (limited to '_test/core') diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index 91eb5293b..f4521256a 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -115,5 +115,8 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { // reload language $local = $conf['lang']; trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true); + + global $INPUT; + $INPUT = new Input(); } } -- cgit v1.2.3