WordPress.org

Make WordPress Core

Ticket #34105: 34105-tests.diff

File 34105-tests.diff, 888 bytes (added by batmoo, 4 years ago)
  • tests/phpunit/tests/kses.php

     
    360360                $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
    361361        }
    362362
     363        function test_hyphenated_tag() {
     364                $string = "<hyphenated-tag attribute=\"value\" otherattribute=\"value2\">Alot of hyphens.</hyphenated-tag>";
     365                $custom_tags = array(
     366                        'hyphenated-tag' => array(
     367                                'attribute' => true,
     368                        ),
     369                );
     370                $expect_stripped_string = 'Alot of hyphens.';
     371
     372                $expect_valid_string = "<hyphenated-tag attribute=\"value\">Alot of hyphens.</hyphenated-tag>";
     373                $this->assertEquals( $expect_stripped_string, wp_kses_post( $string ) );
     374                $this->assertEquals( $expect_valid_string, wp_kses( $string, $custom_tags ) );
     375        }
     376
    363377        /**
    364378         * @ticket 26290
    365379         */