From d8deaf4a82a59cfdcfb6de9b583196dc94095bfd Mon Sep 17 00:00:00 2001 From: Andreas Gohr <gohr@cosmocode.de> Date: Tue, 17 Apr 2012 10:06:57 +0200 Subject: [PATCH] removed hook method from TestRequest --- _testing/bootstrap.php | 5 ----- _testing/phpunit.xml | 6 ++--- .../tests/testing/inttests_hooks.test.php | 22 +++++++++++-------- .../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; } -- GitLab