aboutsummaryrefslogtreecommitdiffstats
path: root/tests/event
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-03-24 15:45:18 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-03-24 15:45:18 +0100
commit400277c03624788e6a31f9aa4a15b883478f58cc (patch)
treeab0959cb6ef734104eb85dcb74da6569559aa3ab /tests/event
parent935a4abb7ec6ab247ee5fa90bd4d4bfe0e2f9f01 (diff)
downloadforums-400277c03624788e6a31f9aa4a15b883478f58cc.tar
forums-400277c03624788e6a31f9aa4a15b883478f58cc.tar.gz
forums-400277c03624788e6a31f9aa4a15b883478f58cc.tar.bz2
forums-400277c03624788e6a31f9aa4a15b883478f58cc.tar.xz
forums-400277c03624788e6a31f9aa4a15b883478f58cc.zip
[feature/event-dispatcher] Change phpbb_event_dispatcher to inheritance, tests
PHPBB3-9550
Diffstat (limited to 'tests/event')
-rw-r--r--tests/event/dispatcher_test.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php
new file mode 100644
index 0000000000..59e51b1cdc
--- /dev/null
+++ b/tests/event/dispatcher_test.php
@@ -0,0 +1,29 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_event_dispatcher_test extends phpbb_test_case
+{
+ public function test_trigger_event()
+ {
+ $dispatcher = new phpbb_event_dispatcher();
+
+ $dispatcher->addListener('core.test_event', function (phpbb_event_data $event) {
+ $event['foo'] = $event['foo'] . '2';
+ $event['bar'] = $event['bar'] . '2';
+ });
+
+ $foo = 'foo';
+ $bar = 'bar';
+
+ $vars = array('foo', 'bar');
+ $result = $dispatcher->trigger_event('core.test_event', compact($vars));
+
+ $this->assertSame(array('foo' => 'foo2', 'bar' => 'bar2'), $result);
+ }
+}