summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Sarnowski <tobias@trustedco.de>2012-04-16 14:42:18 +0000
committerTobias Sarnowski <tobias@trustedco.de>2012-04-16 14:42:18 +0000
commit1101eda89fdb3b8cc5f5fe0dc2c2ac4c1705508e (patch)
treed5d746bceba6088e52ecd1d40525d76fc1d9aa22
parent9a5e1c6a185496cf9afa30ddc6b2b4c00cfd62cc (diff)
downloadrpg-1101eda89fdb3b8cc5f5fe0dc2c2ac4c1705508e.tar.gz
rpg-1101eda89fdb3b8cc5f5fe0dc2c2ac4c1705508e.tar.bz2
added scope tests
verify that multiple requests can be made with multiple test methods.
-rw-r--r--_testing/inttests.php13
-rw-r--r--_testing/inttests/inttests_basic.test.php (renamed from _testing/inttests/basic.test.php)5
-rw-r--r--_testing/inttests/inttests_hooks.test.php (renamed from _testing/inttests/hooks.test.php)0
-rw-r--r--_testing/inttests/inttests_scope.test.php46
4 files changed, 64 insertions, 0 deletions
diff --git a/_testing/inttests.php b/_testing/inttests.php
index 7b263deb9..4eb1f0286 100644
--- a/_testing/inttests.php
+++ b/_testing/inttests.php
@@ -41,6 +41,17 @@ mkdir(DOKU_PLUGIN);
rcopy(TMP_DIR, dirname(__FILE__).'/inttests.conf');
rcopy(TMP_DIR, dirname(__FILE__).'/inttests.data');
+// cleanup dir after exit
+register_shutdown_function(function() {
+ // TODO delete recursive tmp dir
+});
+
+// TODO disable all non-default plugins in config
+// TODO if plugin test, enable plugin
+// TODO load plugin descriptor and enable dependent plugins
+
+// TODO set global variables, phpunit will restore them for every test (test that)
+
// load dw
require_once(DOKU_INC.'inc/init.php');
@@ -142,4 +153,6 @@ class TestResponse {
function getHeaders() {
return $this->headers;
}
+
+ // TODO provide findById, findBy... (https://github.com/cosmocode/dokuwiki-plugin-scrape/blob/master/phpQuery-onefile.php)
}
diff --git a/_testing/inttests/basic.test.php b/_testing/inttests/inttests_basic.test.php
index 56cef965f..78c333963 100644
--- a/_testing/inttests/basic.test.php
+++ b/_testing/inttests/inttests_basic.test.php
@@ -1,6 +1,11 @@
<?php
class BasicTest extends PHPUnit_Framework_TestCase {
+ /**
+ * Execute the simplest possible request and expect
+ * a dokuwiki page which obviously has the word "DokuWiki"
+ * in it somewhere.
+ */
function testSimpleRun() {
$request = new TestRequest();
diff --git a/_testing/inttests/hooks.test.php b/_testing/inttests/inttests_hooks.test.php
index 6a31d5dc2..6a31d5dc2 100644
--- a/_testing/inttests/hooks.test.php
+++ b/_testing/inttests/inttests_hooks.test.php
diff --git a/_testing/inttests/inttests_scope.test.php b/_testing/inttests/inttests_scope.test.php
new file mode 100644
index 000000000..e17b49fb3
--- /dev/null
+++ b/_testing/inttests/inttests_scope.test.php
@@ -0,0 +1,46 @@
+<?php
+
+class ScopeTest extends PHPUnit_Framework_TestCase {
+ /**
+ * It should be possible to have two test cases within one test class.
+ */
+ function testFirstRun() {
+ $request = new TestRequest();
+ $response = $request->execute();
+ $this->assertTrue(
+ strpos($response->getContent(), 'DokuWiki') >= 0,
+ 'DokuWiki was not a word in the output'
+ );
+ }
+
+ /**
+ * @depends testFirstRun
+ */
+ function testSecondRun() {
+ $request = new TestRequest();
+ $response = $request->execute();
+ $this->assertTrue(
+ strpos($response->getContent(), 'DokuWiki') >= 0,
+ 'DokuWiki was not a word in the output'
+ );
+ }
+
+ /**
+ * two requests within the same test case should be possible
+ */
+ function testMultipleRequests() {
+ $request = new TestRequest();
+ $response = $request->execute();
+ $this->assertTrue(
+ strpos($response->getContent(), 'DokuWiki') >= 0,
+ 'DokuWiki was not a word in the output'
+ );
+
+ $request = new TestRequest();
+ $response = $request->execute();
+ $this->assertTrue(
+ strpos($response->getContent(), 'DokuWiki') >= 0,
+ 'DokuWiki was not a word in the output'
+ );
+ }
+}