Make WordPress Core

Ticket #12394: test_post_filtering.php.diff

File test_post_filtering.php.diff, 1.2 KB (added by dougal, 15 years ago)

A couple of kses testcases, including one for this bug.

  • test_post_filtering.php

     
    6060                $this->assertEquals( $expected, $post->post_content );
    6161        }
    6262
     63        // test kses filtering of disallowed attribute
     64        function test_post_content_disallowed_attr() {
     65               
     66                $content = <<<EOF
     67<img src='foo' width='500' href='shlorp' />
     68EOF;
     69
     70                $expected = <<<EOF
     71<img src='foo' width='500' />
     72EOF;
     73
     74                $id = $this->_insert_quick_post(__FUNCTION__, $content);
     75                $post = get_post($id);
     76               
     77                $this->assertEquals( $expected, $post->post_content );
     78        }
     79
     80        // test kses bug. xhtml does not require space before closing
     81        // empty element
     82        function test_post_content_xhtml_empty_elem() {
     83               
     84                $content = <<<EOF
     85<img src='foo' width='500' height='300'/>
     86EOF;
     87
     88                $expected = <<<EOF
     89<img src='foo' width='500' height='300' />
     90EOF;
     91
     92                $id = $this->_insert_quick_post(__FUNCTION__, $content);
     93                $post = get_post($id);
     94               
     95                $this->assertEquals( $expected, $post->post_content );
     96        }
     97
    6398        // make sure unbalanced tags are fixed when they span a --more-- tag
    6499        function test_post_content_unbalanced_more() {
    65100