aboutsummaryrefslogtreecommitdiffstats
path: root/tests/text_formatter/s9e/factory_test.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-03-19 12:45:12 +0100
committerJoshyPHP <s9e.dev@gmail.com>2015-04-02 19:16:03 +0200
commit49b9e8e4eafff93f25a99bf263982fe79b7f0549 (patch)
treee35553682ab88a57a9520b84e4f7e1cdedf13454 /tests/text_formatter/s9e/factory_test.php
parentf4f5bdbaee48d0ed341ec9b720579a4f751916fc (diff)
downloadforums-49b9e8e4eafff93f25a99bf263982fe79b7f0549.tar
forums-49b9e8e4eafff93f25a99bf263982fe79b7f0549.tar.gz
forums-49b9e8e4eafff93f25a99bf263982fe79b7f0549.tar.bz2
forums-49b9e8e4eafff93f25a99bf263982fe79b7f0549.tar.xz
forums-49b9e8e4eafff93f25a99bf263982fe79b7f0549.zip
[ticket/11768] Added configurator events
PHPBB3-11768
Diffstat (limited to 'tests/text_formatter/s9e/factory_test.php')
-rw-r--r--tests/text_formatter/s9e/factory_test.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php
index 7dfa512b28..9f7551ef14 100644
--- a/tests/text_formatter/s9e/factory_test.php
+++ b/tests/text_formatter/s9e/factory_test.php
@@ -16,6 +16,13 @@ require_once __DIR__ . '/../../test_framework/phpbb_database_test_case.php';
class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
{
+ public function setUp()
+ {
+ $this->cache = new phpbb_mock_cache;
+ $this->dispatcher = new phpbb_mock_event_dispatcher;
+ parent::setUp();
+ }
+
public function getDataSet()
{
return $this->createXMLDataSet(__DIR__ . '/fixtures/factory.xml');
@@ -41,6 +48,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$factory = new \phpbb\textformatter\s9e\factory(
$dal,
$this->cache,
+ $this->dispatcher,
$this->get_cache_dir(),
'_foo_parser',
'_foo_renderer'
@@ -184,4 +192,35 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$expected = '<a href="javascript:alert(1)">text</a>';
$this->assertSame($expected, $renderer->render($parser->parse($original)));
}
+
+ /**
+ * @testdox get_configurator() triggers events before and after configuration
+ */
+ public function test_configure_events()
+ {
+ $this->dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface');
+ $this->dispatcher
+ ->expects($this->at(0))
+ ->method('trigger_event')
+ ->with(
+ 'core.text_formatter_s9e_configure_before',
+ $this->callback(array($this, 'configure_event_callback'))
+ )
+ ->will($this->returnArgument(1));
+ $this->dispatcher
+ ->expects($this->at(1))
+ ->method('trigger_event')
+ ->with(
+ 'core.text_formatter_s9e_configure_after',
+ $this->callback(array($this, 'configure_event_callback'))
+ )
+ ->will($this->returnArgument(1));
+
+ $this->get_factory()->get_configurator();
+ }
+
+ public function configure_event_callback($vars)
+ {
+ return isset($vars['configurator']) && $vars['configurator'] instanceof \s9e\TextFormatter\Configurator;
+ }
}