aboutsummaryrefslogtreecommitdiffstats
path: root/tests/text_formatter/s9e/factory_test.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-03-03 04:18:17 +0100
committerJoshyPHP <s9e.dev@gmail.com>2015-04-02 19:16:02 +0200
commit78b544920c0d3984dd814cfe59f43c46feac6f12 (patch)
treebb7c9c67c8fe249e367d0071a58d516e45afcf0f /tests/text_formatter/s9e/factory_test.php
parentdc9a28d346370b38c10def92358170a5cef23b36 (diff)
downloadforums-78b544920c0d3984dd814cfe59f43c46feac6f12.tar
forums-78b544920c0d3984dd814cfe59f43c46feac6f12.tar.gz
forums-78b544920c0d3984dd814cfe59f43c46feac6f12.tar.bz2
forums-78b544920c0d3984dd814cfe59f43c46feac6f12.tar.xz
forums-78b544920c0d3984dd814cfe59f43c46feac6f12.zip
[ticket/11768] Added support for creating unsafe BBCodes
PHPBB3-11768
Diffstat (limited to 'tests/text_formatter/s9e/factory_test.php')
-rw-r--r--tests/text_formatter/s9e/factory_test.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php
index a1378514b4..8df841605d 100644
--- a/tests/text_formatter/s9e/factory_test.php
+++ b/tests/text_formatter/s9e/factory_test.php
@@ -78,9 +78,6 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
// This custom BBCode should be set
$this->assertTrue(isset($configurator->BBCodes['CUSTOM']));
- // This unsafe custom BBCode will trigger an exception and should be ignored
- $this->assertFalse(isset($configurator->BBCodes['UNSAFE']));
-
$this->assertTrue(isset($configurator->Emoticons[':D']));
}
@@ -176,4 +173,19 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$expected = $original;
$this->assertSame($expected, $renderer->render($parser->parse($original)));
}
+
+ /**
+ * @testdox Accepts unsafe custom BBCodes
+ */
+ public function test_unsafe_bbcode()
+ {
+ $fixture = __DIR__ . '/fixtures/unsafe_bbcode.xml';
+ $container = $this->get_test_case_helpers()->set_s9e_services(null, $fixture);
+ $parser = $container->get('text_formatter.parser');
+ $renderer = $container->get('text_formatter.renderer');
+
+ $original = '[xss=javascript:alert(1)]text[/xss]';
+ $expected = '<a href="javascript:alert(1)">text</a>';
+ $this->assertSame($expected, $renderer->render($parser->parse($original)));
+ }
}