summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_testing/core/DokuWikiTest.php21
-rw-r--r--_testing/tests/testing/inttests_plugins.test.php31
-rw-r--r--_testing/tests/testing/inttests_plugins_default.test.php24
3 files changed, 52 insertions, 24 deletions
diff --git a/_testing/core/DokuWikiTest.php b/_testing/core/DokuWikiTest.php
index 2517e25e3..f464aab8e 100644
--- a/_testing/core/DokuWikiTest.php
+++ b/_testing/core/DokuWikiTest.php
@@ -3,6 +3,12 @@
* Helper class to provide basic functionality for tests
*/
abstract class DokuWikiTest extends PHPUnit_Framework_TestCase {
+
+ // tests can override this
+ protected $pluginsEnabled = array();
+ // tests can override this
+ protected $pluginsDisabled = array();
+
/**
* Reset the DokuWiki environment before each test run
*
@@ -51,6 +57,21 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase {
}
}
+ // disable and enable configured plugins
+ foreach ($this->pluginsDisabled as $plugin) {
+ if (!$plugin_controller->disable($plugin)) {
+ throw new Exception('Could not disable plugin "'.$plugin.'"!');
+ }
+ }
+ foreach ($this->pluginsEnabled as $plugin) {
+ /* enable() returns false but works...
+ if (!$plugin_controller->enable($plugin)) {
+ throw new Exception('Could not enable plugin "'.$plugin.'"!');
+ }
+ */
+ $plugin_controller->enable($plugin);
+ }
+
// reset event handler
global $EVENT_HANDLER;
$EVENT_HANDLER = new Doku_Event_Handler();
diff --git a/_testing/tests/testing/inttests_plugins.test.php b/_testing/tests/testing/inttests_plugins.test.php
index bf3775b26..ac6d1ee45 100644
--- a/_testing/tests/testing/inttests_plugins.test.php
+++ b/_testing/tests/testing/inttests_plugins.test.php
@@ -5,32 +5,15 @@
*/
class InttestsPluginsTest extends DokuWikiTest {
- function testTestingPluginEnabled() {
- global $EVENT_HANDLER, $plugin_controller;
-
- $this->assertTrue(
- $plugin_controller->enable('testing'),
- 'Could not enable testing plugin.'
+ function setUp() {
+ $this->pluginsEnabled = array(
+ 'testing'
);
- $request = new TestRequest();
- $hookTriggered = false;
-
- $EVENT_HANDLER->register_hook('TESTING_PLUGIN_INSTALLED', 'AFTER', null,
- function() use (&$hookTriggered) {
- $hookTriggered = true;
- }
- );
-
- $request->execute();
-
- $this->assertTrue($hookTriggered, 'Testing plugin did not trigger!');
+ parent::setUp();
}
- /**
- * @depends testTestingPluginEnabled
- */
- function testTestingPluginDisabledDefault() {
+ function testTestingPluginEnabled() {
global $EVENT_HANDLER;
$request = new TestRequest();
@@ -44,6 +27,6 @@ class InttestsPluginsTest extends DokuWikiTest {
$request->execute();
- $this->assertFalse($hookTriggered, 'Testing plugin did trigger!');
- }
+ $this->assertTrue($hookTriggered, 'Testing plugin did not trigger!');
+ }
}
diff --git a/_testing/tests/testing/inttests_plugins_default.test.php b/_testing/tests/testing/inttests_plugins_default.test.php
new file mode 100644
index 000000000..a96dac931
--- /dev/null
+++ b/_testing/tests/testing/inttests_plugins_default.test.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @group integration
+ */
+class InttestsPluginsDefaultTest extends DokuWikiTest {
+
+ function testTestingPluginDisabledDefault() {
+ global $EVENT_HANDLER;
+
+ $request = new TestRequest();
+ $hookTriggered = false;
+
+ $EVENT_HANDLER->register_hook('TESTING_PLUGIN_INSTALLED', 'AFTER', null,
+ function() use (&$hookTriggered) {
+ $hookTriggered = true;
+ }
+ );
+
+ $request->execute();
+
+ $this->assertFalse($hookTriggered, 'Testing plugin did trigger!');
+ }
+}