Make WordPress Core

Changeset 47781


Ignore:
Timestamp:
05/10/2020 08:29:18 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Give canonical test fixtures for paginated content more descriptive names.

Follow-up to [47727].

See #28081, #40773, #45337.

Location:
trunk/tests/phpunit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r47122 r47781  
    6262                        )
    6363                );
    64                 $post_id          = $factory->post->create(
     64
     65                $gallery_post_id = $factory->post->create(
    6566                        array(
    6667                                'post_title' => 'post-format-test-gallery',
    … …  
    6869                        )
    6970                );
    70                 self::$post_ids[] = $post_id;
    71                 $factory->post->create(
     71
     72                self::$post_ids[] = $gallery_post_id;
     73
     74                self::$post_ids[] = $factory->post->create(
    7275                        array(
    7376                                'import_id'   => 611,
    7477                                'post_type'   => 'attachment',
    7578                                'post_title'  => 'canola2',
    76                                 'post_parent' => $post_id,
    77                         )
    78                 );
    79                 self::$post_ids[] = $post_id;
    80 
    81                 self::$post_ids[] = $factory->post->create(
    82                         array(
    83                                 'post_title'   => 'images-test',
     79                                'post_parent' => $gallery_post_id,
     80                        )
     81                );
     82
     83                self::$post_ids[] = $factory->post->create(
     84                        array(
     85                                'post_title' => 'images-test',
     86                                'post_date'  => '2008-09-03 00:00:00',
     87                        )
     88                );
     89
     90                self::$post_ids[] = $factory->post->create(
     91                        array(
     92                                'post_title'   => 'multipage-post-test',
    8493                                'post_date'    => '2008-09-03 00:00:00',
    8594                                'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3',
    … …  
    8796                );
    8897
    89                 $post_id           = $factory->post->create(
     98                self::$post_ids[] = $factory->post->create(
     99                        array(
     100                                'post_title' => 'non-paged-post-test',
     101                                'post_date'  => '2008-09-03 00:00:00',
     102                        )
     103                );
     104
     105                $comment_post_id = $factory->post->create(
    90106                        array(
    91107                                'import_id'  => 149,
    … …  
    94110                        )
    95111                );
    96                 self::$post_ids[]  = $post_id;
    97                 self::$comment_ids = $factory->comment->create_post_comments( $post_id, 15 );
     112
     113                self::$post_ids[]  = $comment_post_id;
     114                self::$comment_ids = $factory->comment->create_post_comments( $comment_post_id, 15 );
    98115
    99116                self::$post_ids[] = $factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );
    … …  
    109126                        )
    110127                );
     128
    111129                self::$post_ids[] = $factory->post->create(
    112130                        array(
    … …  
    115133                        )
    116134                );
    117                 $post_id          = $factory->post->create(
     135
     136                $parent_page_id = $factory->post->create(
    118137                        array(
    119138                                'post_type'  => 'page',
    … …  
    121140                        )
    122141                );
    123                 self::$post_ids[] = $post_id;
     142
     143                self::$post_ids[] = $parent_page_id;
     144
    124145                self::$post_ids[] = $factory->post->create(
    125146                        array(
    … …  
    127148                                'post_type'   => 'page',
    128149                                'post_title'  => 'child-page-1',
    129                                 'post_parent' => $post_id,
    130                         )
    131                 );
    132 
    133                 $parent_id        = $factory->post->create(
     150                                'post_parent' => $parent_page_id,
     151                        )
     152                );
     153
     154                $parent_page_id = $factory->post->create(
    134155                        array(
    135156                                'post_name' => 'parent',
    … …  
    137158                        )
    138159                );
    139                 self::$post_ids[] = $parent_id;
    140                 $child_id_1       = $factory->post->create(
     160
     161                self::$post_ids[] = $parent_page_id;
     162
     163                $child_id_1 = $factory->post->create(
    141164                        array(
    142165                                'post_name'   => 'child1',
    143166                                'post_type'   => 'page',
    144                                 'post_parent' => $parent_id,
    145                         )
    146                 );
     167                                'post_parent' => $parent_page_id,
     168                        )
     169                );
     170
    147171                self::$post_ids[] = $child_id_1;
    148                 $child_id_2       = $factory->post->create(
     172
     173                $child_id_2 = $factory->post->create(
    149174                        array(
    150175                                'post_name'   => 'child2',
    151176                                'post_type'   => 'page',
    152                                 'post_parent' => $parent_id,
    153                         )
    154                 );
     177                                'post_parent' => $parent_page_id,
     178                        )
     179                );
     180
    155181                self::$post_ids[] = $child_id_2;
    156                 $grandchild_id_1  = $factory->post->create(
     182
     183                $grandchild_id_1 = $factory->post->create(
    157184                        array(
    158185                                'post_name'   => 'grandchild',
    … …  
    161188                        )
    162189                );
     190
    163191                self::$post_ids[] = $grandchild_id_1;
    164                 $grandchild_id_2  = $factory->post->create(
     192
     193                $grandchild_id_2 = $factory->post->create(
    165194                        array(
    166195                                'post_name'   => 'grandchild',
    … …  
    169198                        )
    170199                );
     200
    171201                self::$post_ids[] = $grandchild_id_2;
    172202
    173                 $cat1                             = $factory->term->create(
     203                $cat1 = $factory->term->create(
    174204                        array(
    175205                                'taxonomy' => 'category',
    … …  
    177207                        )
    178208                );
     209
    179210                self::$terms['/category/parent/'] = $cat1;
    180                 self::$term_ids[ $cat1 ]          = 'category';
    181 
    182                 $cat2                                     = $factory->term->create(
     211
     212                self::$term_ids[ $cat1 ] = 'category';
     213
     214                $cat2 = $factory->term->create(
    183215                        array(
    184216                                'taxonomy' => 'category',
    … …  
    187219                        )
    188220                );
     221
    189222                self::$terms['/category/parent/child-1/'] = $cat2;
    190                 self::$term_ids[ $cat2 ]                  = 'category';
     223
     224                self::$term_ids[ $cat2 ] = 'category';
    191225
    192226                $cat3 = $factory->term->create(
    … …  
    197231                        )
    198232                );
     233
    199234                self::$terms['/category/parent/child-1/child-2/'] = $cat3;
    200                 self::$term_ids[ $cat3 ]                          = 'category';
    201 
    202                 $cat4                    = $factory->term->create(
     235
     236                self::$term_ids[ $cat3 ] = 'category';
     237
     238                $cat4 = $factory->term->create(
    203239                        array(
    204240                                'taxonomy' => 'category',
    … …  
    206242                        )
    207243                );
     244
    208245                self::$term_ids[ $cat4 ] = 'category';
    209246
    210                 $cat5                    = $factory->term->create(
     247                $cat5 = $factory->term->create(
    211248                        array(
    212249                                'taxonomy' => 'category',
    … …  
    214251                        )
    215252                );
     253
    216254                self::$term_ids[ $cat5 ] = 'category';
    217255
    218                 $tag1                    = $factory->term->create( array( 'name' => 'post-formats' ) );
     256                $tag1 = $factory->term->create(
     257                        array(
     258                                'name' => 'post-formats',
     259                        )
     260                );
     261
    219262                self::$term_ids[ $tag1 ] = 'post_tag';
    220263        }
  • trunk/tests/phpunit/tests/canonical.php

    r47727 r47781  
    160160                        array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/' ),
    161161
    162                         array(
    163                                 '/2008/09/03/images-test/3/',
    164                                 array(
    165                                         'url' => '/2008/09/03/images-test/3/',
    166                                         'qv'  => array(
    167                                                 'name'     => 'images-test',
     162                        // Pagination.
     163                        array(
     164                                '/2008/09/03/multipage-post-test/3/',
     165                                array(
     166                                        'url' => '/2008/09/03/multipage-post-test/3/',
     167                                        'qv'  => array(
     168                                                'name'     => 'multipage-post-test',
    168169                                                'year'     => '2008',
    169170                                                'monthnum' => '09',
    … …  
    173174                                ),
    174175                        ),
    175                         array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
    176                         array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
    177 
    178                         array( '/2008/03/03/comment-test/3/', '/2008/03/03/comment-test/' ),
    179                         array( '/2008/03/03/comment-test/?page=3', '/2008/03/03/comment-test/' ),
     176                        array( '/2008/09/03/multipage-post-test/?page=3', '/2008/09/03/multipage-post-test/3/' ),
     177                        array( '/2008/09/03/multipage-post-te?page=3', '/2008/09/03/multipage-post-test/3/' ),
     178
     179                        array( '/2008/09/03/non-paged-post-test/3/', '/2008/09/03/non-paged-post-test/' ),
     180                        array( '/2008/09/03/non-paged-post-test/?page=3', '/2008/09/03/non-paged-post-test/' ),
    180181
    181182                        // Comments.
Note: See TracChangeset for help on using the changeset viewer.