Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
18.18% |
4 / 22 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_text_processing_smilies_test | |
18.18% |
4 / 22 |
|
50.00% |
1 / 2 |
4.19 | |
0.00% |
0 / 1 |
| test_text_formatter | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| get_text_formatter_tests | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | class phpbb_text_processing_smilies_test extends phpbb_test_case |
| 15 | { |
| 16 | /** |
| 17 | * @dataProvider get_text_formatter_tests |
| 18 | */ |
| 19 | public function test_text_formatter($original, $expected) |
| 20 | { |
| 21 | $container = $this->get_test_case_helpers()->set_s9e_services(null, __DIR__ . '/fixtures/smilies.xml'); |
| 22 | $parser = $container->get('text_formatter.parser'); |
| 23 | $renderer = $container->get('text_formatter.renderer'); |
| 24 | |
| 25 | $this->assertSame($expected, $renderer->render($parser->parse($original))); |
| 26 | } |
| 27 | |
| 28 | public static function get_text_formatter_tests() |
| 29 | { |
| 30 | return array( |
| 31 | array( |
| 32 | ':) beginning', |
| 33 | '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile"> beginning' |
| 34 | ), |
| 35 | array( |
| 36 | 'end :)', |
| 37 | 'end <img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile">' |
| 38 | ), |
| 39 | array( |
| 40 | ':)', |
| 41 | '<img class="smilies" src="phpBB/images/smilies/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile">' |
| 42 | ), |
| 43 | array( |
| 44 | 'xx (18) 8) xx', |
| 45 | 'xx (18) <img class="smilies" src="phpBB/images/smilies/custom.gif" width="17" height="18" alt="8)" title="8)"> xx' |
| 46 | ), |
| 47 | ); |
| 48 | } |
| 49 | } |