Skip to content

Commit 083ef65

Browse files
committed
Tests_Formatting_ConvertInvalidEntities: convert tests to use data provider
Maintains the existing tests, just changes the way the tests are run.
1 parent 25bc89f commit 083ef65

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

tests/phpunit/tests/formatting/ConvertInvalidEntries.php

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,36 @@
44
* @group formatting
55
*/
66
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 ) );
1118
}
1219

1320
/**
14-
* @ticket 20503
21+
* Data provider with test cases intended to be handled by the function.
22+
*
23+
* @return array
1524
*/
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+
);
2037
}
2138

2239
function test_escapes_lone_ampersands() {

0 commit comments

Comments
 (0)