|
4 | 4 | * @group formatting
|
5 | 5 | */
|
6 | 6 | class Tests_Formatting_ConvertInvalidEntities extends WP_UnitTestCase {
|
7 |
| - function test_replaces_windows1252_entities_with_unicode_ones() { |
8 |
| - $input = '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ'; |
9 |
| - $output = '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ'; |
10 |
| - $this->assertSame( $output, convert_invalid_entities( $input ) ); |
| 7 | + |
| 8 | + /** |
| 9 | + * @dataProvider data_convert_invalid_entities_strings |
| 10 | + * |
| 11 | + * @covers :: convert_invalid_entities |
| 12 | + * |
| 13 | + * @param mixed $input Supposedly a string with entities that need converting. |
| 14 | + * @param string $expected Expected function output. |
| 15 | + */ |
| 16 | + public function test_convert_invalid_entities( $input, $expected ) { |
| 17 | + $this->assertSame( $expected, convert_invalid_entities( $input ) ); |
11 | 18 | }
|
12 | 19 |
|
13 | 20 | /**
|
14 |
| - * @ticket 20503 |
| 21 | + * Data provider with test cases intended to be handled by the function. |
| 22 | + * |
| 23 | + * @return array |
15 | 24 | */
|
16 |
| - function test_replaces_latin_letter_z_with_caron() { |
17 |
| - $input = 'Žž'; |
18 |
| - $output = 'Žž'; |
19 |
| - $this->assertSame( $output, convert_invalid_entities( $input ) ); |
| 25 | + public function data_convert_invalid_entities_strings() { |
| 26 | + return array( |
| 27 | + 'replaces windows1252 entities with unicode ones' => array( |
| 28 | + 'input' => '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ', |
| 29 | + 'expected' => '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ', |
| 30 | + ), |
| 31 | + // @ticket 20503 |
| 32 | + 'replaces latin letter z with caron' => array( |
| 33 | + 'input' => 'Žž', |
| 34 | + 'expected' => 'Žž', |
| 35 | + ), |
| 36 | + ); |
20 | 37 | }
|
21 | 38 |
|
22 | 39 | function test_escapes_lone_ampersands() {
|
|
0 commit comments