WordPress.org

Make WordPress Core

Ticket #6297: 6297-untitests.diff

File 6297-untitests.diff, 2.8 KB (added by MikeHansenMe, 5 years ago)

see #30284

  • tests/phpunit/tests/post/filtering.php

    diff --git a/tests/phpunit/tests/post/filtering.php b/tests/phpunit/tests/post/filtering.php
    index 57c4ed7..fff1b20 100644
    a b EOF; 
    9090                $this->assertEquals( $expected, $post->post_content );
    9191        }
    9292
     93        /**
     94         * make sure unbalanced tags are fixed when they span a --more-- tag
     95         * @ticket 6297
     96         */
     97        function test_post_content_unbalanced_more() {
     98                $content = <<<EOF
     99<em>some text<!--more-->
     100that's continued after the jump</em>
     101EOF;
     102
     103                $expected = <<<EOF
     104<em>some text</em><!--more-->
     105that's continued after the jump
     106EOF;
     107
     108                $id = $this->factory->post->create( array( 'post_content' => $content ) );
     109                $post = get_post($id);
     110
     111                $this->assertEquals( $expected, $post->post_content );
     112        }
     113
     114        /**
     115         * make sure unbalanced tags are fixed when they span a --nextpage-- tag
     116         * @ticket 6297
     117         */
     118        function test_post_content_unbalanced_nextpage() {
     119                $content = <<<EOF
     120<em>some text<!--nextpage-->
     121that's continued after the jump</em>
     122EOF;
     123
     124                $expected = <<<EOF
     125<em>some text</em><!--nextpage-->
     126that's continued after the jump
     127EOF;
     128
     129                $id = $this->factory->post->create( array( 'post_content' => $content ) );
     130                $post = get_post($id);
     131
     132                $this->assertEquals( $expected, $post->post_content );
     133        }
     134
     135        /**
     136         * make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order)
     137         * @ticket 6297
     138         */
     139        function test_post_content_unbalanced_more_nextpage() {
     140                $content = <<<EOF
     141<em>some text<!--more-->
     142that's continued after the jump</em>
     143<!--nextpage-->
     144<p>and the next page
     145<!--nextpage-->
     146breaks the graf</p>
     147EOF;
     148
     149                $expected = <<<EOF
     150<em>some text</em><!--more-->
     151that's continued after the jump
     152<!--nextpage-->
     153<p>and the next page
     154</p><!--nextpage-->
     155breaks the graf
     156EOF;
     157
     158                $id = $this->factory->post->create( array( 'post_content' => $content ) );
     159                $post = get_post($id);
     160
     161                $this->assertEquals( $expected, $post->post_content );
     162        }
     163
     164        /**
     165         * make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order)
     166         * @ticket 6297
     167         */
     168        function test_post_content_unbalanced_nextpage_more() {
     169                $content = <<<EOF
     170<em>some text<!--nextpage-->
     171that's continued after the jump</em>
     172<!--more-->
     173<p>and the next page
     174<!--nextpage-->
     175breaks the graf</p>
     176EOF;
     177
     178                $expected = <<<EOF
     179<em>some text</em><!--nextpage-->
     180that's continued after the jump
     181<!--more-->
     182<p>and the next page
     183</p><!--nextpage-->
     184breaks the graf
     185EOF;
     186
     187                $id = $this->factory->post->create( array( 'post_content' => $content ) );
     188                $post = get_post($id);
     189
     190                $this->assertEquals( $expected, $post->post_content );
     191        }
     192
    93193        // make sure unbalanced tags are untouched when the balance option is off
    94194        function test_post_content_nobalance_nextpage_more() {
    95195