Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions tests/phpunit/tests/formatting/balanceTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,29 +205,28 @@ public function data_single_tags() {
}

/**
* Test unknown self closing tag.
*
* @ticket 1597
* @dataProvider data_unknown_single_tags_with_closing_tag
*/
public function test_closes_unknown_single_tags_with_closing_tag() {
public function test_closes_unknown_single_tags_with_closing_tag( $input, $expected ) {
$this->assertSame( $expected, balanceTags( $input, true ) );
}

$inputs = array(
'<strong/>',
'<em />',
'<p class="main1"/>',
'<p class="main2" />',
'<STRONG/>',
);
$expected = array(
'<strong></strong>',
'<em></em>',
'<p class="main1"></p>',
'<p class="main2"></p>',
// Valid tags are transformed to lowercase.
'<strong></strong>',
/**
* Data provider for test_closes_unknown_single_tags_with_closing_tag.
*
* @return array<string, array<string, string>>
*/
public function data_unknown_single_tags_with_closing_tag() {
return array(
'default' => array( '<strong/>', '<strong></strong>' ),
'with-space' => array( '<em />', '<em></em>' ),
'with-class' => array( '<p class="main1"/>', '<p class="main1"></p>' ),
'with-class-and-space' => array( '<p class="main2" />', '<p class="main2"></p>' ),
'uppercase' => array( '<STRONG/>', '<strong></strong>' ),
);

foreach ( $inputs as $key => $input ) {
$this->assertSame( $expected[ $key ], balanceTags( $inputs[ $key ], true ) );
}
}

public function test_closes_unclosed_single_tags_having_attributes() {
Expand Down
Loading