Make WordPress Core

Ticket #20210: 20210-allowed-html-ut.diff

File 20210-allowed-html-ut.diff, 1.1 KB (added by ryan, 13 years ago)
  • tests/kses.php

     
    295295                        }
    296296                }
    297297        }
     298
     299        public function test_wp_kses_allowed_html() {
     300                global $allowedposttags, $allowedtags, $allowedentitynames;
     301
     302                // These won't be equal because wp_kses_allowed_html() adds global attributes
     303                $this->assertNotEquals( $allowedposttags, wp_kses_allowed_html( 'post' ) );
     304
     305                $allowed_tags = wp_kses_allowed_html( 'post' ) ;
     306
     307                foreach ( $allowed_tags as $tag ) {
     308                        $this->assertTrue( $tag['class'] );
     309                        $this->assertTrue( $tag['id'] );
     310                        $this->assertTrue( $tag['style'] );
     311                        $this->assertTrue( $tag['title'] );
     312                }
     313
     314                $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
     315                $this->assertEquals( $allowedtags, wp_kses_allowed_html( '' ) );
     316                $this->assertEquals( $allowedtags, wp_kses_allowed_html() );
     317
     318                $allowed_tags = wp_kses_allowed_html( 'user_description' );
     319                $this->assertTrue( $allowed_tags['a']['rel'] );
     320
     321                $this->assertEquals( array(), wp_kses_allowed_html( 'strip' ) );
     322        }
    298323}