Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_acp_smilies_test | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| test_htmlspecialchars | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
6 | |||
| 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 | /** |
| 15 | * @group functional |
| 16 | */ |
| 17 | class phpbb_functional_acp_smilies_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | public function test_htmlspecialchars() |
| 20 | { |
| 21 | $this->login(); |
| 22 | $this->admin_login(); |
| 23 | |
| 24 | // Create the BBCode |
| 25 | $crawler = self::request('GET', 'adm/index.php?i=acp_icons&sid=' . $this->sid . '&mode=smilies&action=edit&id=1'); |
| 26 | $form = $crawler->selectButton('Submit')->form(array( |
| 27 | 'code[icon_e_biggrin.svg]' => '>:D', |
| 28 | 'emotion[icon_e_biggrin.svg]' => '>:D' |
| 29 | )); |
| 30 | self::submit($form); |
| 31 | |
| 32 | // Test it in the "new topic" preview |
| 33 | $crawler = self::request('GET', 'posting.php?mode=post&f=2&sid=' . $this->sid); |
| 34 | $form = $crawler->selectButton('Preview')->form(array( |
| 35 | 'subject' => 'subject', |
| 36 | 'message' => '>:D' |
| 37 | )); |
| 38 | $crawler = self::submit($form); |
| 39 | |
| 40 | $html = $crawler->filter('#preview')->html(); |
| 41 | |
| 42 | // Native HTML5 parser (PHP 8.4+) will encode entities |
| 43 | if (\PHP_VERSION_ID >= 80400) |
| 44 | { |
| 45 | $this->assertMatchesRegularExpression('(<img [^>]+ alt=">:D" title=">:D"[^>]*>)', $html); |
| 46 | } |
| 47 | else |
| 48 | { |
| 49 | $this->assertMatchesRegularExpression('(<img [^>]+ alt=">:D" title=">:D"[^>]*>)', $html); |
| 50 | } |
| 51 | } |
| 52 | } |