Changeset 407 in tests for wp-testcase/test_post_filtering.php
- Timestamp:
- 08/04/2011 08:38:26 PM (15 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_post_filtering.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_post_filtering.php
r366 r407 10 10 update_option('use_balanceTags', 1); 11 11 kses_init_filters(); 12 13 } 14 12 13 } 14 15 15 function tearDown() { 16 16 parent::tearDown(); 17 17 kses_remove_filters(); 18 18 } 19 19 20 20 function _insert_quick_post($title, $content, $more=array()) { 21 21 return $this->post_ids[] = wp_insert_post(array_merge(array( … … 26 26 ), $more)); 27 27 } 28 28 29 29 // a simple test to make sure unclosed tags are fixed 30 30 function test_post_content_unknown_tag() { 31 31 32 32 $content = <<<EOF 33 33 <foobar>no such tag</foobar> … … 40 40 $id = $this->_insert_quick_post(__FUNCTION__, $content); 41 41 $post = get_post($id); 42 43 $this->assertEquals( $expected, $post->post_content ); 44 } 45 42 43 $this->assertEquals( $expected, $post->post_content ); 44 } 45 46 46 // a simple test to make sure unbalanced tags are fixed 47 47 function test_post_content_unbalanced_tag() { 48 48 49 49 $content = <<<EOF 50 50 <i>italics … … 57 57 $id = $this->_insert_quick_post(__FUNCTION__, $content); 58 58 $post = get_post($id); 59 59 60 60 $this->assertEquals( $expected, $post->post_content ); 61 61 } … … 63 63 // test kses filtering of disallowed attribute 64 64 function test_post_content_disallowed_attr() { 65 65 66 66 $content = <<<EOF 67 67 <img src='foo' width='500' href='shlorp' /> … … 74 74 $id = $this->_insert_quick_post(__FUNCTION__, $content); 75 75 $post = get_post($id); 76 76 77 77 $this->assertEquals( $expected, $post->post_content ); 78 78 } … … 81 81 // empty element 82 82 function test_post_content_xhtml_empty_elem() { 83 $this->knownWPBug( 12394 ); 83 $this->knownWPBug( 12394 ); 84 84 $content = <<<EOF 85 85 <img src='foo' width='500' height='300'/> … … 92 92 $id = $this->_insert_quick_post(__FUNCTION__, $content); 93 93 $post = get_post($id); 94 94 95 95 $this->assertEquals( $expected, $post->post_content ); 96 96 } … … 98 98 // make sure unbalanced tags are fixed when they span a --more-- tag 99 99 function test_post_content_unbalanced_more() { 100 100 101 101 $content = <<<EOF 102 102 <em>some text<!--more--> … … 111 111 $id = $this->_insert_quick_post(__FUNCTION__, $content); 112 112 $post = get_post($id); 113 113 114 114 $this->assertEquals( $expected, $post->post_content ); 115 115 } … … 117 117 // make sure unbalanced tags are fixed when they span a --nextpage-- tag 118 118 function test_post_content_unbalanced_nextpage() { 119 119 120 120 $content = <<<EOF 121 121 <em>some text<!--nextpage--> … … 130 130 $id = $this->_insert_quick_post(__FUNCTION__, $content); 131 131 $post = get_post($id); 132 132 133 133 $this->assertEquals( $expected, $post->post_content ); 134 134 } … … 136 136 // make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order) 137 137 function test_post_content_unbalanced_more_nextpage() { 138 138 139 139 $content = <<<EOF 140 140 <em>some text<!--more--> … … 157 157 $id = $this->_insert_quick_post(__FUNCTION__, $content); 158 158 $post = get_post($id); 159 160 $this->assertEquals( $expected, $post->post_content ); 161 } 162 159 160 $this->assertEquals( $expected, $post->post_content ); 161 } 162 163 163 // make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order) 164 164 function test_post_content_unbalanced_nextpage_more() { 165 165 166 166 $content = <<<EOF 167 167 <em>some text<!--nextpage--> … … 184 184 $id = $this->_insert_quick_post(__FUNCTION__, $content); 185 185 $post = get_post($id); 186 187 $this->assertEquals( $expected, $post->post_content ); 188 } 189 186 187 $this->assertEquals( $expected, $post->post_content ); 188 } 189 190 190 // make sure unbalanced tags are untouched when the balance option is off 191 191 function test_post_content_nobalance_nextpage_more() { 192 192 193 193 update_option('use_balanceTags', 0); 194 194 195 195 $content = <<<EOF 196 196 <em>some text<!--nextpage--> … … 204 204 $id = $this->_insert_quick_post(__FUNCTION__, $content); 205 205 $post = get_post($id); 206 206 207 207 $this->assertEquals( $content, $post->post_content ); 208 } 208 } 209 209 } 210 210
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)