Opened 5 years ago
Closed 5 years ago
#50860 closed defect (bug) (fixed)
Fix duplicate array keys in Tests_Kses::test_wp_filter_post_kses_address method
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.6 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch |
| Focuses: | Cc: |
Description
This is the current code
function test_wp_filter_post_kses_address() {
global $allowedposttags;
$attributes = array(
'class' => 'classname',
'id' => 'id',
'style' => 'color: red;',
'style' => 'color: red',
'style' => 'color: red; text-align:center',
'style' => 'color: red; text-align:center;',
'title' => 'title',
);
foreach ( $attributes as $name => $value ) {
$string = "<address $name='$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 ) );
}
}
Here you can see the $attributes array contains four duplicate style keys. So in practive, we are only testing for the last value of style that is color: red; text-align:center;.
This patch tries to fix this problem by separating test assertions for styles.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
In 48744: