diff options
author | Guy Brand <gb@unistra.fr> | 2012-09-10 17:04:45 +0200 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2012-09-10 17:04:45 +0200 |
commit | 0f8ac4e8c5872a6b68b350f96a9ecde0291edefa (patch) | |
tree | ad7938bb4143d5e5a38fd7a8d131e4171aec657d /_test/tests/test/basic.test.php | |
parent | 58ec8fa9128e4581749955de87530f432e387588 (diff) | |
parent | b31fcef02fd24b3e746c9618e77152c7b84c2f2a (diff) | |
download | rpg-0f8ac4e8c5872a6b68b350f96a9ecde0291edefa.tar.gz rpg-0f8ac4e8c5872a6b68b350f96a9ecde0291edefa.tar.bz2 |
Merge branch 'master' into stable
Diffstat (limited to '_test/tests/test/basic.test.php')
-rw-r--r-- | _test/tests/test/basic.test.php | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/_test/tests/test/basic.test.php b/_test/tests/test/basic.test.php new file mode 100644 index 000000000..a0ea48a3a --- /dev/null +++ b/_test/tests/test/basic.test.php @@ -0,0 +1,105 @@ +<?php + +/** + * @group integration + */ +class InttestsBasicTest extends DokuWikiTest { + /** + * Execute the simplest possible request and expect + * a dokuwiki page which obviously has the word "DokuWiki" + * in it somewhere. + */ + function testSimpleRun() { + $request = new TestRequest(); + + $response = $request->execute(); + + $this->assertTrue( + strpos($response->getContent(), 'DokuWiki') >= 0, + 'DokuWiki was not a word in the output' + ); + } + + function testPost() { + $request = new TestRequest(); + + $input = array( + 'string' => 'A string', + 'array' => array(1, 2, 3), + 'id' => 'wiki:dokuwiki' + ); + + $response = $request->post($input); + + // server var check + $this->assertEquals('POST',$request->getServer('REQUEST_METHOD')); + $this->assertEquals('',$request->getServer('QUERY_STRING')); + $this->assertEquals('/doku.php',$request->getServer('REQUEST_URI')); + + // variable setup check + $this->assertEquals('A string', $request->getPost('string')); + $this->assertEquals(array(1, 2, 3), $request->getPost('array')); + $this->assertEquals('wiki:dokuwiki', $request->getPost('id')); + + // output check + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + } + + function testPostGet() { + $request = new TestRequest(); + + $input = array( + 'string' => 'A string', + 'array' => array(1, 2, 3), + ); + + $response = $request->post($input,'/doku.php?id=wiki:dokuwiki'); + + // server var check + $this->assertEquals('POST',$request->getServer('REQUEST_METHOD')); + $this->assertEquals('?id=wiki:dokuwiki',$request->getServer('QUERY_STRING')); + $this->assertEquals('/doku.php?id=wiki:dokuwiki',$request->getServer('REQUEST_URI')); + + // variable setup check + $this->assertEquals('A string', $request->getPost('string')); + $this->assertEquals(array(1, 2, 3), $request->getPost('array')); + $this->assertEquals('wiki:dokuwiki', $request->getGet('id')); + + // output check + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + } + + function testGet() { + $request = new TestRequest(); + + $input = array( + 'string' => 'A string', + 'array' => array(1, 2, 3), + 'test' => 'bar' + ); + + $response = $request->get($input,'/doku.php?id=wiki:dokuwiki&test=foo'); + + // server var check + $this->assertEquals('GET',$request->getServer('REQUEST_METHOD')); + $this->assertEquals( + '?id=wiki:dokuwiki&test=bar&string=A+string&array[0]=1&array[1]=2&array[2]=3', + $request->getServer('QUERY_STRING') + ); + $this->assertEquals( + '/doku.php?id=wiki:dokuwiki&test=bar&string=A+string&array[0]=1&array[1]=2&array[2]=3', + $request->getServer('REQUEST_URI') + ); + + // variable setup check + $this->assertEquals('A string', $request->getGet('string')); + $this->assertEquals(array(1, 2, 3), $request->getGet('array')); + $this->assertEquals('wiki:dokuwiki', $request->getGet('id')); + $this->assertEquals('bar', $request->getGet('test')); + + // output check + $this->assertTrue(strpos($response->getContent(), 'Andreas Gohr') >= 0); + } + + +} |