Make WordPress Core

Changeset 48744

Timestamp:
08/06/2020 01:26:06 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/kses.php

    r48572 r48744  
    1717            'class' => 'classname',
    1818            'id'    => 'id',
    19             'style' => 'color: red;',
    20             'style' => 'color: red',
    21             'style' => 'color: red; text-align:center',
    22             'style' => 'color: red; text-align:center;',
     19            'style' => array(
     20                'color: red;',
     21                'color: red',
     22                'color: red; text-align:center',
     23                'color: red; text-align:center;',
     24            ),
    2325            'title' => 'title',
    2426        );
    2527
    26         foreach ( $attributes as $name => $value ) {
    27             $string        = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
    28             $expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>";
    29             $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
     28        foreach ( $attributes as $name => $values ) {
     29            foreach ( (array) $values as $value ) {
     30                $string        = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
     31                $expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>";
     32                $this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
     33            }
    3034        }
    3135    }
Note: See TracChangeset for help on using the changeset viewer.