diff options
author | lisps <stummp@loewen.de> | 2014-02-04 10:59:06 +0100 |
---|---|---|
committer | lisps <stummp@loewen.de> | 2014-02-04 10:59:06 +0100 |
commit | fe717f57f7a1c262eb6104ccb575ee3294712afa (patch) | |
tree | d3eac7f90c8af179be2a2ec61d8fbf58a19d5336 | |
parent | c7e0f3b572ef25116f649a04d0cd2e729ff97f9a (diff) | |
download | rpg-fe717f57f7a1c262eb6104ccb575ee3294712afa.tar.gz rpg-fe717f57f7a1c262eb6104ccb575ee3294712afa.tar.bz2 |
fix content check test cases
add test case new Input check
add global variables to execute
-rw-r--r-- | _test/core/TestRequest.php | 9 | ||||
-rw-r--r-- | _test/tests/test/basic.test.php | 16 |
2 files changed, 20 insertions, 5 deletions
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; } diff --git a/_test/tests/test/basic.test.php b/_test/tests/test/basic.test.php index 86acef935..0639f0c5a 100644 --- a/_test/tests/test/basic.test.php +++ b/_test/tests/test/basic.test.php @@ -33,7 +33,7 @@ class InttestsBasicTest extends DokuWikiTest { $response = $request->execute(); $this->assertTrue( - strpos($response->getContent(), 'DokuWiki') >= 0, + strpos($response->getContent(), 'DokuWiki') !== false, 'DokuWiki was not a word in the output' ); } @@ -60,7 +60,7 @@ class InttestsBasicTest extends DokuWikiTest { $this->assertEquals('wiki:dokuwiki', $request->getPost('id')); // output check - $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false); } function testPostGet() { @@ -84,7 +84,7 @@ class InttestsBasicTest extends DokuWikiTest { $this->assertEquals('wiki:dokuwiki', $request->getGet('id')); // output check - $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false); } function testGet() { @@ -116,7 +116,7 @@ class InttestsBasicTest extends DokuWikiTest { $this->assertEquals('bar', $request->getGet('test')); // output check - $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') !== false); } function testScripts() { @@ -168,5 +168,13 @@ class InttestsBasicTest extends DokuWikiTest { $response = new TestResponse('',array_slice($this->some_headers,0,-2)); // slice off the last two headers to leave no status header $this->assertNull($response->getStatusCode()); } + + function testINPUT() { + $request = new TestRequest(); + $response = $request->get(array('id' => 'mailinglist'), '/doku.php'); + + // output check + $this->assertTrue(strpos($response->getContent(), 'Netiquette') !== false); + } } |