1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11768] This commit integrates s9e\TextFormatter

This commit integrates s9e\TextFormatter as outlined in
http://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=44467

PHPBB3-11768
This commit is contained in:
s9e
2014-11-22 20:00:58 +01:00
committed by JoshyPHP
parent eb7e6d7c23
commit 147a713cc0
75 changed files with 5967 additions and 161 deletions

View File

@@ -0,0 +1,87 @@
<?php
/**
*
* @package testing
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
class phpbb_text_processing_decode_message_test extends phpbb_test_case
{
/**
* @dataProvider get_legacy_tests
*/
public function test_legacy($original, $expected, $bbcode_uid = '')
{
$actual = $original;
decode_message($actual, $bbcode_uid);
$this->assertSame($expected, $actual);
}
public function get_legacy_tests()
{
return array(
array(
"&amp;&lt;&gt;&quot;'",
"&amp;&lt;&gt;&quot;'"
),
array(
'<!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->',
':)'
),
/**
* Fails as per PHPBB3-8420
* @link http://tracker.phpbb.com/browse/PHPBB3-8420
*
array(
'[url=http://example.com:2cpxwbdy]<!-- s:arrow: --><img src="{SMILIES_PATH}/icon_arrow.gif" alt=":arrow:" title="Arrow" /><!-- s:arrow: --> here[/url:2cpxwbdy]',
'[url=http://example.com] :arrow: here[/url]',
'2cpxwbdy'
),
*/
);
}
/**
* @dataProvider get_text_formatter_tests
*/
public function test_text_formatter($original, $expected)
{
$this->get_test_case_helpers()->set_s9e_services();
$actual = $original;
decode_message($actual);
$this->assertSame($expected, $actual);
}
public function get_text_formatter_tests()
{
return array(
array(
"<t>&amp;&lt;&gt;\"'",
"&amp;&lt;&gt;&quot;'"
),
array(
'<r><E>:)</E></r>',
':)'
),
array(
"<t>a<br/>\nb</t>",
"a\nb"
),
/**
* @link http://tracker.phpbb.com/browse/PHPBB3-8420
*/
array(
'<r><URL url="http://example.com"><s>[url=http://example.com]</s> <E>:arrow:</E> here<e>[/url]</e></URL></r>',
'[url=http://example.com] :arrow: here[/url]'
),
);
}
}