1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 02:06:32 +02:00

Merge branch '3.2.x'

This commit is contained in:
Marc Alexander
2018-01-25 18:44:22 +01:00
6 changed files with 82 additions and 14 deletions

View File

@@ -495,8 +495,11 @@ class phpbb_test_case_helpers
$request = new phpbb_mock_request;
}
// Get a log interface
$log = ($container->has('log')) ? $container->get('log') : $this->test_case->getMockBuilder('phpbb\\log\\log_interface')->getMock();
// Create and register the text_formatter.s9e.factory service
$factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $cache_dir, $cache_key_parser, $cache_key_renderer);
$factory = new \phpbb\textformatter\s9e\factory($dal, $cache, $dispatcher, $config, new \phpbb\textformatter\s9e\link_helper, $log, $cache_dir, $cache_key_parser, $cache_key_renderer);
$container->set('text_formatter.s9e.factory', $factory);
// Create a user if none was provided, and add the common lang strings

View File

@@ -56,6 +56,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$this->dispatcher,
new \phpbb\config\config(array('allowed_schemes_links' => 'http,https,ftp')),
new \phpbb\textformatter\s9e\link_helper,
$this->getMockBuilder('phpbb\\log\\log_interface')->getMock(),
$this->get_cache_dir(),
'_foo_parser',
'_foo_renderer'
@@ -263,6 +264,23 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case
$this->assertSame($expected, $renderer->render($parser->parse($original)));
}
/**
* @testdox Logs malformed BBCodes
*/
public function test_malformed_bbcodes()
{
$log = $this->getMockBuilder('phpbb\\log\\log_interface')->getMock();
$log->expects($this->once())
->method('add')
->with('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, ['[x !x]{TEXT}[/x]', 'Cannot interpret the BBCode definition']);
$container = new phpbb_mock_container_builder;
$container->set('log', $log);
$fixture = __DIR__ . '/fixtures/malformed_bbcode.xml';
$this->get_test_case_helpers()->set_s9e_services($container, $fixture);
}
/**
* @testdox get_configurator() triggers events before and after configuration
*/

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="phpbb_bbcodes">
<column>bbcode_id</column>
<column>bbcode_tag</column>
<column>bbcode_helpline</column>
<column>display_on_posting</column>
<column>bbcode_match</column>
<column>bbcode_tpl</column>
<column>first_pass_match</column>
<column>first_pass_replace</column>
<column>second_pass_match</column>
<column>second_pass_replace</column>
<row>
<value>13</value>
<value>x</value>
<value></value>
<value>1</value>
<value>[x !x]{TEXT}[/x]</value>
<value>...</value>
<value/>
<value/>
<value/>
<value/>
</row>
</table>
</dataset>