Skip to content

Commit 84e5ace

Browse files
Tests: Use named data provider in a balanceTags() test.
Follow-up to [661/tests], [45929]. Props rahmohn. See #64225. git-svn-id: https://develop.svn.wordpress.org/trunk@61715 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7924b71 commit 84e5ace

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

tests/phpunit/tests/formatting/balanceTags.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,29 @@ public function data_single_tags() {
205205
}
206206

207207
/**
208+
* Tests closing unknown single tags.
209+
*
208210
* @ticket 1597
211+
* @dataProvider data_unknown_single_tags_with_closing_tag
209212
*/
210-
public function test_closes_unknown_single_tags_with_closing_tag() {
213+
public function test_closes_unknown_single_tags_with_closing_tag( $input, $expected ) {
214+
$this->assertSame( $expected, balanceTags( $input, true ) );
215+
}
211216

212-
$inputs = array(
213-
'<strong/>',
214-
'<em />',
215-
'<p class="main1"/>',
216-
'<p class="main2" />',
217-
'<STRONG/>',
218-
);
219-
$expected = array(
220-
'<strong></strong>',
221-
'<em></em>',
222-
'<p class="main1"></p>',
223-
'<p class="main2"></p>',
217+
/**
218+
* Data provider for test_closes_unknown_single_tags_with_closing_tag.
219+
*
220+
* @return array<string, array<string, string>>
221+
*/
222+
public function data_unknown_single_tags_with_closing_tag() {
223+
return array(
224+
'default' => array( '<strong/>', '<strong></strong>' ),
225+
'with-space' => array( '<em />', '<em></em>' ),
226+
'with-class' => array( '<p class="main1"/>', '<p class="main1"></p>' ),
227+
'with-class-and-space' => array( '<p class="main2" />', '<p class="main2"></p>' ),
224228
// Valid tags are transformed to lowercase.
225-
'<strong></strong>',
229+
'uppercase' => array( '<STRONG/>', '<strong></strong>' ),
226230
);
227-
228-
foreach ( $inputs as $key => $input ) {
229-
$this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
230-
}
231231
}
232232

233233
public function test_closes_unclosed_single_tags_having_attributes() {

0 commit comments

Comments
 (0)