Make WordPress Core

Ticket #9256: 9256.4.diff

File 9256.4.diff, 18.4 KB (added by boonebgorges, 10 years ago)
  • src/wp-includes/query.php

    diff --git src/wp-includes/query.php src/wp-includes/query.php
    index 1334272..15da274 100644
    class WP_Query { 
    37103710                        do_action_ref_array( 'loop_start', array( &$this ) );
    37113711
    37123712                $post = $this->next_post();
    3713                 setup_postdata($post);
     3713                $this->setup_postdata( $post );
    37143714        }
    37153715
    37163716        /**
    class WP_Query { 
    45454545        }
    45464546
    45474547        /**
     4548         * Set up global post data.
     4549         *
     4550         * @since 4.1.0
     4551         *
     4552         * @param object $post Post data.
     4553         * @return bool True when finished.
     4554         */
     4555        public function setup_postdata( $post ) {
     4556                global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
     4557
     4558                $id = (int) $post->ID;
     4559
     4560                $authordata = get_userdata($post->post_author);
     4561
     4562                $currentday = mysql2date('d.m.y', $post->post_date, false);
     4563                $currentmonth = mysql2date('m', $post->post_date, false);
     4564                $numpages = 1;
     4565                $multipage = 0;
     4566                $page = $this->get( 'page' );
     4567                if ( ! $page )
     4568                        $page = 1;
     4569
     4570                // Force full post content when viewing the permalink for the $post, or
     4571                // when on an RSS feed. Otherwise respect the 'more' tag.
     4572                if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {
     4573                        $more = 1;
     4574                } else if ( $this->is_feed() ) {
     4575                        $more = 1;
     4576                } else {
     4577                        $more = 0;
     4578                }
     4579
     4580                $content = $post->post_content;
     4581                if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
     4582                        if ( $page > 1 )
     4583                                $more = 1;
     4584                        $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
     4585                        $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
     4586                        $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
     4587                        // Ignore nextpage at the beginning of the content.
     4588                        if ( 0 === strpos( $content, '<!--nextpage-->' ) )
     4589                                $content = substr( $content, 15 );
     4590                        $pages = explode('<!--nextpage-->', $content);
     4591                        $numpages = count($pages);
     4592                        if ( $numpages > 1 )
     4593                                $multipage = 1;
     4594                } else {
     4595                        $pages = array( $post->post_content );
     4596                }
     4597
     4598                /**
     4599                 * Fires once the post data has been setup.
     4600                 *
     4601                 * @since 2.8.0
     4602                 *
     4603                 * @param WP_Post &$post The Post object (passed by reference).
     4604                 */
     4605                do_action_ref_array( 'the_post', array( &$post ) );
     4606
     4607                return true;
     4608        }
     4609        /**
    45484610         * After looping through a nested query, this function
    45494611         * restores the $post global to the current post in this query.
    45504612         *
    function wp_old_slug_redirect() { 
    46304692 * @return bool True when finished.
    46314693 */
    46324694function setup_postdata( $post ) {
    4633         global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
    4634 
    4635         $id = (int) $post->ID;
    4636 
    4637         $authordata = get_userdata($post->post_author);
     4695        global $wp_query;
    46384696
    4639         $currentday = mysql2date('d.m.y', $post->post_date, false);
    4640         $currentmonth = mysql2date('m', $post->post_date, false);
    4641         $numpages = 1;
    4642         $multipage = 0;
    4643         $page = get_query_var('page');
    4644         if ( ! $page )
    4645                 $page = 1;
    4646         if ( is_single() || is_page() || is_feed() )
    4647                 $more = 1;
    4648         $content = $post->post_content;
    4649         if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
    4650                 if ( $page > 1 )
    4651                         $more = 1;
    4652                 $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
    4653                 $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
    4654                 $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
    4655                 // Ignore nextpage at the beginning of the content.
    4656                 if ( 0 === strpos( $content, '<!--nextpage-->' ) )
    4657                         $content = substr( $content, 15 );
    4658                 $pages = explode('<!--nextpage-->', $content);
    4659                 $numpages = count($pages);
    4660                 if ( $numpages > 1 )
    4661                         $multipage = 1;
    4662         } else {
    4663                 $pages = array( $post->post_content );
     4697        if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
     4698                return $wp_query->setup_postdata( $post );
    46644699        }
    46654700
    4666         /**
    4667          * Fires once the post data has been setup.
    4668          *
    4669          * @since 2.8.0
    4670          *
    4671          * @param WP_Post &$post The Post object (passed by reference).
    4672          */
    4673         do_action_ref_array( 'the_post', array( &$post ) );
    4674 
    4675         return true;
     4701        return false;
    46764702}
  • new file tests/phpunit/tests/formatting/WpTrimExcerpt.php

    diff --git tests/phpunit/tests/formatting/WpTrimExcerpt.php tests/phpunit/tests/formatting/WpTrimExcerpt.php
    new file mode 100644
    index 0000000..564e4b7
    - +  
     1<?php
     2
     3/**
     4 * @group formatting
     5 * @covers wp_trim_excerpt
     6 */
     7class Tests_Formatting_WpTrimExcerpt extends WP_UnitTestCase {
     8        /**
     9         * @ticket 25349
     10         */
     11        public function test_secondary_loop_respect_more() {
     12                $post1 = $this->factory->post->create( array(
     13                        'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2',
     14                ) );
     15                $post2 = $this->factory->post->create( array(
     16                        'post_content' => 'Post 2 Page 1<!--more-->Post 2 Page 2',
     17                ) );
     18
     19                $this->go_to( '/?p=' . $post1 );
     20                setup_postdata( get_post( $post1 ) );
     21
     22                $q = new WP_Query( array(
     23                        'post__in' => array( $post2 ),
     24                ) );
     25                if ( $q->have_posts() ) {
     26                        while ( $q->have_posts() ) {
     27                                $q->the_post();
     28                                $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
     29                        }
     30                }
     31        }
     32
     33        /**
     34         * @ticket 25349
     35         */
     36        public function test_secondary_loop_respect_nextpage() {
     37                $post1 = $this->factory->post->create( array(
     38                        'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
     39                ) );
     40                $post2 = $this->factory->post->create( array(
     41                        'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
     42                ) );
     43
     44                $this->go_to( '/?p=' . $post1 );
     45                setup_postdata( get_post( $post1 ) );
     46
     47                $q = new WP_Query( array(
     48                        'post__in' => array( $post2 ),
     49                ) );
     50                if ( $q->have_posts() ) {
     51                        while ( $q->have_posts() ) {
     52                                $q->the_post();
     53                                $this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
     54                        }
     55                }
     56        }
     57}
  • tests/phpunit/tests/query.php

    diff --git tests/phpunit/tests/query.php tests/phpunit/tests/query.php
    index cf59d90..a6f68c2 100644
    class Tests_Query extends WP_UnitTestCase { 
    1515        }
    1616
    1717        /**
    18          * @ticket 16746
    19          */
    20         function test_nextpage_at_start_of_content() {
    21                 $post = $this->factory->post->create_and_get( array( 'post_content' => '<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
    22                 setup_postdata( $post );
    23 
    24                 $this->assertEquals( 1, $GLOBALS['multipage'] );
    25                 $this->assertCount(  3, $GLOBALS['pages']     );
    26                 $this->assertEquals( 3, $GLOBALS['numpages']  );
    27                 $this->assertEquals( array( 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
    28         }
    29 
    30         function test_setup_postdata_single_page() {
    31                 $post = $this->factory->post->create_and_get( array( 'post_content' => 'Page 0' ) );
    32                 setup_postdata( $post );
    33 
    34                 $this->assertEquals( 0, $GLOBALS['multipage'] );
    35                 $this->assertCount(  1, $GLOBALS['pages']     );
    36                 $this->assertEquals( 1, $GLOBALS['numpages']  );
    37                 $this->assertEquals( array( 'Page 0' ), $GLOBALS['pages'] );
    38         }
    39 
    40         function test_setup_postdata_multi_page() {
    41                 $post = $this->factory->post->create_and_get( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
    42                 setup_postdata( $post );
    43 
    44                 $this->assertEquals( 1, $GLOBALS['multipage'] );
    45                 $this->assertCount(  4, $GLOBALS['pages']     );
    46                 $this->assertEquals( 4, $GLOBALS['numpages']  );
    47                 $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
    48         }
    49 
    50         /**
    51          * @ticket 24330
    52          *
    53          * setup_postdata( $a_post ) followed by the_content() in a loop that does not update
    54          * global $post should use the content of $a_post rather then the global post.
    55          */
    56         function test_setup_postdata_loop() {
    57                 $post_id = $this->factory->post->create( array( 'post_content' => 'global post' ) );
    58                 $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
    59 
    60                 $ids = $this->factory->post->create_many(5);
    61                 foreach ( $ids as $id ) {
    62                         $page = get_post( $id );
    63                         if ( $page ) {
    64                                 setup_postdata( $page );
    65                                 $content = get_echo( 'the_content', array() );
    66                                 $this->assertEquals( $post_id, $GLOBALS['post']->ID );
    67                                 $this->assertNotEquals( '<p>global post</p>', strip_ws( $content ) );
    68                                 wp_reset_postdata();
    69                         }
    70                 }
    71         }
    72 
    73         /**
    7418         * @ticket 24785
    7519         *
    7620         */
    class Tests_Query extends WP_UnitTestCase { 
    14791                $this->assertCount( 1, $query->get( 'tag_slug__in' ) );
    14892                $this->assertEquals( $query->get_queried_object(), $tag );
    14993        }
    150 }
    151  No newline at end of file
     94}
  • new file tests/phpunit/tests/query/setupPostdata.php

    diff --git tests/phpunit/tests/query/setupPostdata.php tests/phpunit/tests/query/setupPostdata.php
    new file mode 100644
    index 0000000..1a8967c
    - +  
     1<?php
     2
     3/**
     4 * @group query
     5 * @covers setup_postdata
     6 */
     7class Tests_Query_SetupPostdata extends WP_UnitTestCase {
     8        protected $global_keys = array( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );
     9
     10        protected $global_data = array();
     11
     12        public function setUp() {
     13                parent::setUp();
     14                return;
     15
     16                foreach ( $this->global_keys as $global_key ) {
     17                        if ( isset( $GLOBALS[ $global_key ] ) ) {
     18                                $this->global_data[ $global_key ] = $GLOBALS[ $global_key ];
     19                                unset( $GLOBALS[ $global_key ] );
     20                        } else {
     21                                $this->global_data[ $global_key ] = null;
     22                        }
     23                }
     24        }
     25
     26        public function tearDown() {
     27                parent::tearDown();
     28                return;
     29
     30                foreach ( $this->global_keys as $global_key ) {
     31                        if ( ! is_null( $this->global_data[ $global_key ] ) ) {
     32                                $GLOBALS[ $global_key ] = $this->global_data[ $global_key ];
     33                        } else {
     34                                unset( $GLOBALS[ $global_key ] );
     35                        }
     36                }
     37
     38                $this->global_data = array();
     39        }
     40
     41        public function test_id() {
     42                $p = $this->factory->post->create_and_get();
     43                setup_postdata( $p );
     44
     45                $this->assertNotEmpty( $p->ID );
     46                $this->assertSame( $p->ID, $GLOBALS['id'] );
     47        }
     48
     49        public function test_authordata() {
     50                $u = $this->factory->user->create_and_get();
     51                $p = $this->factory->post->create_and_get( array(
     52                        'post_author' => $u->ID,
     53                ) );
     54                setup_postdata( $p );
     55
     56                $this->assertNotEmpty( $GLOBALS['authordata'] );
     57                $this->assertEquals( $u, $GLOBALS['authordata'] );
     58        }
     59
     60        public function test_currentday() {
     61                $p = $this->factory->post->create_and_get( array(
     62                        'post_date' => '1980-09-09 06:30:00',
     63                ) );
     64                setup_postdata( $p );
     65
     66                $this->assertSame( '09.09.80', $GLOBALS['currentday'] );
     67        }
     68
     69        public function test_currentmonth() {
     70                $p = $this->factory->post->create_and_get( array(
     71                        'post_date' => '1980-09-09 06:30:00',
     72                ) );
     73                setup_postdata( $p );
     74
     75                $this->assertSame( '09', $GLOBALS['currentmonth'] );
     76        }
     77
     78        public function test_secondary_query_post_vars() {
     79                $users = $this->factory->user->create_many( 2 );
     80
     81                $post1 = $this->factory->post->create_and_get( array(
     82                        'post_author' => $users[0],
     83                        'post_date' => '2012-02-02 02:00:00',
     84                ) );
     85
     86                $post2 = $this->factory->post->create_and_get( array(
     87                        'post_author' => $users[1],
     88                        'post_date' => '2013-03-03 03:00:00',
     89                ) );
     90
     91                $this->go_to( get_permalink( $post1 ) );
     92                setup_postdata( $post1 );
     93
     94                // Main loop.
     95                $this->assertSame( $post1->ID, $GLOBALS['id'] );
     96                $this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
     97                $this->assertSame( '02.02.12', $GLOBALS['currentday'] );
     98                $this->assertSame( '02', $GLOBALS['currentmonth'] );
     99
     100                // Secondary loop.
     101                $q = new WP_Query( array(
     102                        'posts_per_page' => 1,
     103                ) );
     104                if ( $q->have_posts() ) {
     105                        while ( $q->have_posts() ) {
     106                                $q->the_post();
     107
     108                                // Should refer to the current loop.
     109                                $this->assertSame( $post2->ID, $GLOBALS['id'] );
     110                                $this->assertEquals( get_userdata( $users[1] ), $GLOBALS['authordata'] );
     111                                $this->assertSame( '03.03.13', $GLOBALS['currentday'] );
     112                                $this->assertSame( '03', $GLOBALS['currentmonth'] );
     113                        }
     114                }
     115                wp_reset_postdata();
     116
     117                // Should be reset to main loop.
     118                $this->assertSame( $post1->ID, $GLOBALS['id'] );
     119                $this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
     120                $this->assertSame( '02.02.12', $GLOBALS['currentday'] );
     121                $this->assertSame( '02', $GLOBALS['currentmonth'] );
     122        }
     123
     124        public function test_single_page() {
     125                $post = $this->factory->post->create_and_get( array(
     126                        'post_content' => 'Page 0',
     127                ) );
     128                setup_postdata( $post );
     129
     130                $this->assertSame( 0, $GLOBALS['multipage'] );
     131                $this->assertSame( 1, $GLOBALS['numpages']  );
     132                $this->assertEquals( array( 'Page 0' ), $GLOBALS['pages'] );
     133        }
     134
     135        public function test_multi_page() {
     136                $post = $this->factory->post->create_and_get( array(
     137                        'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
     138                ) );
     139                setup_postdata( $post );
     140
     141                $this->assertSame( 1, $GLOBALS['multipage'] );
     142                $this->assertSame( 4, $GLOBALS['numpages']  );
     143                $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
     144        }
     145
     146        /**
     147         * @ticket 16746
     148         */
     149        public function test_nextpage_at_start_of_content() {
     150                $post = $this->factory->post->create_and_get( array(
     151                        'post_content' => '<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
     152                ) );
     153                setup_postdata( $post );
     154
     155                $this->assertSame( 1, $GLOBALS['multipage'] );
     156                $this->assertSame( 3, $GLOBALS['numpages'] );
     157                $this->assertEquals( array( 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
     158        }
     159
     160        public function test_trim_nextpage_linebreaks() {
     161                $post = $this->factory->post->create_and_get( array(
     162                        'post_content' => "Page 0\n<!--nextpage-->\nPage 1\nhas a line break\n<!--nextpage-->Page 2<!--nextpage-->\n\nPage 3",
     163                ) );
     164                setup_postdata( $post );
     165
     166                $this->assertEquals( array( 'Page 0', "Page 1\nhas a line break", 'Page 2', "\nPage 3" ), $GLOBALS['pages'] );
     167        }
     168
     169        /**
     170         * @ticket 25349
     171         */
     172        public function test_secondary_query_nextpage() {
     173                $post1 = $this->factory->post->create( array(
     174                        'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
     175                ) );
     176                $post2 = $this->factory->post->create( array(
     177                        'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
     178                ) );
     179
     180                $this->go_to( '/?p=' . $post1 );
     181                setup_postdata( get_post( $post1 ) );
     182
     183                // Main loop.
     184                $this->assertSame( array( 'Post 1 Page 1', 'Post 1 Page 2' ), $GLOBALS['pages'] );
     185
     186                // Secondary loop.
     187                $q = new WP_Query( array(
     188                        'post__in' => array( $post2 ),
     189                ) );
     190                if ( $q->have_posts() ) {
     191                        while ( $q->have_posts() ) {
     192                                $q->the_post();
     193
     194                                // Should refer to the current loop.
     195                                $this->assertSame( array( 'Post 2 Page 1', 'Post 2 Page 2' ), $GLOBALS['pages'] );
     196                        }
     197                }
     198                wp_reset_postdata();
     199
     200                // Should be reset to main loop.
     201                $this->assertSame( array( 'Post 1 Page 1', 'Post 1 Page 2' ), $GLOBALS['pages'] );
     202        }
     203
     204        public function test_page_from_wp_query() {
     205                $page = $this->factory->post->create_and_get( array(
     206                        'post_type' => 'page',
     207                ) );
     208
     209                $this->go_to( '/?page=78' );
     210
     211                $GLOBALS['wp_query']->query_vars['page'] = 78;
     212                setup_postdata( $page );
     213
     214                $this->assertSame( 78, $GLOBALS['page'] );
     215        }
     216
     217        public function test_page_when_on_page() {
     218                $page = $this->factory->post->create_and_get( array(
     219                        'post_type' => 'page',
     220                ) );
     221                $this->go_to( get_permalink( $page ) );
     222                setup_postdata( $page );
     223
     224                $this->assertSame( 1, $GLOBALS['page'] );
     225        }
     226
     227        /**
     228         * @ticket 20904
     229         */
     230        public function test_secondary_query_page() {
     231                $post = $this->factory->post->create_and_get();
     232                $this->go_to( '/?page=3' );
     233                setup_postdata( $post );
     234
     235                // Main loop.
     236                $this->assertSame( 3, $GLOBALS['page'] );
     237
     238                // Secondary loop.
     239                $posts = $this->factory->post->create_many( 5 );
     240                $q = new WP_Query( array(
     241                        'page' => 4,
     242                        'posts_per_page' => 1,
     243                ) );
     244                if ( $q->have_posts() ) {
     245                        while ( $q->have_posts() ) {
     246                                $q->the_post();
     247
     248                                // $page should refer to the current loop.
     249                                $this->assertSame( 4, $GLOBALS['page'] );
     250                        }
     251                }
     252                wp_reset_postdata();
     253
     254                // $page should be reset to main loop.
     255                $this->assertSame( 3, $GLOBALS['page'] );
     256        }
     257
     258        /**
     259         * @ticket 20904
     260         */
     261        public function test_more_when_on_setup_post() {
     262                $post = $this->factory->post->create_and_get();
     263                $this->go_to( get_permalink( $post ) );
     264                setup_postdata( $post );
     265
     266                $this->assertSame( 1, $GLOBALS['more'] );
     267        }
     268
     269        /**
     270         * @ticket 20904
     271         *
     272         * $more should not be true when the set-up post is not the same as the current post.
     273         */
     274        public function test_more_when_on_single() {
     275                $post1 = $this->factory->post->create_and_get();
     276                $post2 = $this->factory->post->create_and_get();
     277                $this->go_to( get_permalink( $post1 ) );
     278                setup_postdata( $post2 );
     279
     280                $this->assertTrue( empty( $GLOBALS['more'] ) );
     281        }
     282
     283        /**
     284         * @ticket 20904
     285         *
     286         * $more should not be true when the set-up post is not the same as the current page.
     287         */
     288        public function test_more_when_on_page() {
     289                $post = $this->factory->post->create_and_get();
     290                $page = $this->factory->post->create_and_get( array(
     291                        'post_type' => 'page',
     292                ) );
     293                $this->go_to( get_permalink( $page ) );
     294                setup_postdata( $post );
     295
     296                $this->assertTrue( empty( $GLOBALS['more'] ) );
     297        }
     298
     299        /**
     300         * @ticket 20904
     301         */
     302        public function test_more_when_on_feed() {
     303                $post = $this->factory->post->create_and_get();
     304                $this->go_to( '/?feed=rss' );
     305                setup_postdata( $post );
     306
     307                $this->assertSame( 1, $GLOBALS['more'] );
     308        }
     309
     310        /**
     311         * @ticket 20904
     312         * @ticket 25349
     313         */
     314        public function test_secondary_query_more() {
     315                $post = $this->factory->post->create_and_get();
     316                $this->go_to( get_permalink( $post ) );
     317                setup_postdata( $post );
     318
     319                // Main loop.
     320                $this->assertSame( 1, $GLOBALS['more'] );
     321
     322                // Secondary loop.
     323                $q = new WP_Query( array(
     324                        'posts_per_page' => 1,
     325                ) );
     326                if ( $q->have_posts() ) {
     327                        while ( $q->have_posts() ) {
     328                                $q->the_post();
     329
     330                                // $more should refer to the current loop.
     331                                $this->assertTrue( empty( $GLOBALS['more'] ) );
     332                        }
     333                }
     334                wp_reset_postdata();
     335
     336                // $page should be reset to main loop.
     337                $this->assertSame( 1, $GLOBALS['more'] );
     338        }
     339
     340        /**
     341         * @ticket 24330
     342         *
     343         * setup_postdata( $a_post ) followed by the_content() in a loop that does not update
     344         * global $post should use the content of $a_post rather then the global post.
     345         */
     346        function test_setup_postdata_loop() {
     347                $post_id = $this->factory->post->create( array( 'post_content' => 'global post' ) );
     348                $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
     349
     350                $ids = $this->factory->post->create_many(5);
     351                foreach ( $ids as $id ) {
     352                        $page = get_post( $id );
     353                        if ( $page ) {
     354                                setup_postdata( $page );
     355                                $content = get_echo( 'the_content', array() );
     356                                $this->assertEquals( $post_id, $GLOBALS['post']->ID );
     357                                $this->assertNotEquals( '<p>global post</p>', strip_ws( $content ) );
     358                                wp_reset_postdata();
     359                        }
     360                }
     361        }
     362
     363}