Tests: Correct duplicate array keys in Tests_Kses::test_wp_filter_post_kses_address().

Previously, only the last `style` value was actually tested.

Props ediamin.
Fixes #50860.

git-svn-id: https://develop.svn.wordpress.org/trunk@48744 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-06 13:26:06 +00:00
parent 103d7d1613
commit 58f9000f3e

View File

@ -16,19 +16,23 @@ class Tests_Kses extends WP_UnitTestCase {
$attributes = array( $attributes = array(
'class' => 'classname', 'class' => 'classname',
'id' => 'id', 'id' => 'id',
'style' => 'color: red;', 'style' => array(
'style' => 'color: red', 'color: red;',
'style' => 'color: red; text-align:center', 'color: red',
'style' => 'color: red; text-align:center;', 'color: red; text-align:center',
'color: red; text-align:center;',
),
'title' => 'title', 'title' => 'title',
); );
foreach ( $attributes as $name => $value ) { foreach ( $attributes as $name => $values ) {
foreach ( (array) $values as $value ) {
$string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>"; $string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
$expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>"; $expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>";
$this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) ); $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
} }
} }
}
/** /**
* @ticket 20210 * @ticket 20210