diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2012-04-17 10:06:57 +0200 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2012-04-17 10:06:57 +0200 |
commit | d8deaf4a82a59cfdcfb6de9b583196dc94095bfd (patch) | |
tree | 625ce870681795533bf5e29b73754dde0b4661c7 | |
parent | 3ab58ffe5551d68e5a34f8e29e55c5e0c2511570 (diff) | |
download | rpg-d8deaf4a82a59cfdcfb6de9b583196dc94095bfd.tar.gz rpg-d8deaf4a82a59cfdcfb6de9b583196dc94095bfd.tar.bz2 |
removed hook method from TestRequest
-rw-r--r-- | _testing/bootstrap.php | 5 | ||||
-rw-r--r-- | _testing/phpunit.xml | 6 | ||||
-rw-r--r-- | _testing/tests/testing/inttests_hooks.test.php | 22 | ||||
-rw-r--r-- | _testing/tests/testing/inttests_reset.test.php | 3 |
4 files changed, 17 insertions, 19 deletions
diff --git a/_testing/bootstrap.php b/_testing/bootstrap.php index 5b828141f..6a4bae728 100644 --- a/_testing/bootstrap.php +++ b/_testing/bootstrap.php @@ -211,11 +211,6 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { // Helper class to execute a fake request class TestRequest { - function hook($hook, $step, $function) { - global $EVENT_HANDLER; - $null = null; - $EVENT_HANDLER->register_hook($hook, $step, $null, $function); - } function execute() { global $output_buffer; diff --git a/_testing/phpunit.xml b/_testing/phpunit.xml index 934b50a3b..bb0768b90 100644 --- a/_testing/phpunit.xml +++ b/_testing/phpunit.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit - bootstrap="bootstrap.php" - convertNoticesToExceptions="false" - backupGlobals="yes"> + bootstrap="bootstrap.php" + convertNoticesToExceptions="false" + backupGlobals="yes"> <testsuites> <testsuite name="DokuWiki Tests"> diff --git a/_testing/tests/testing/inttests_hooks.test.php b/_testing/tests/testing/inttests_hooks.test.php index 98ca77e82..621b9f9b8 100644 --- a/_testing/tests/testing/inttests_hooks.test.php +++ b/_testing/tests/testing/inttests_hooks.test.php @@ -5,16 +5,20 @@ */ class InttestsHooksTest extends DokuWikiTest { - function testHookTriggering() { - $request = new TestRequest(); + function testHookTriggering() { + global $EVENT_HANDLER; - $hookTriggered = false; - $request->hook('TPL_CONTENT_DISPLAY', 'AFTER', function() use (&$hookTriggered) { - $hookTriggered = true; - }); + $request = new TestRequest(); + $hookTriggered = false; - $request->execute(); + $EVENT_HANDLER->register_hook('TPL_CONTENT_DISPLAY', 'AFTER', null, + function() use (&$hookTriggered) { + $hookTriggered = true; + } + ); - $this->assertTrue($hookTriggered, 'Hook was not triggered as expected!'); - } + $request->execute(); + + $this->assertTrue($hookTriggered, 'Hook was not triggered as expected!'); + } } diff --git a/_testing/tests/testing/inttests_reset.test.php b/_testing/tests/testing/inttests_reset.test.php index 2241421f5..7c5978543 100644 --- a/_testing/tests/testing/inttests_reset.test.php +++ b/_testing/tests/testing/inttests_reset.test.php @@ -12,9 +12,8 @@ class InttestsScopeTest extends DokuWikiTest { $conf['foo'] = 'bar'; global $EVENT_HANDLER; - $null = null; $self = $this; - $EVENT_HANDLER->register_hook('DOKUWIKI_STARTED', 'AFTER', $null, + $EVENT_HANDLER->register_hook('DOKUWIKI_STARTED', 'AFTER', null, function() use ($self) { $self->triggered = true; } |