Make WordPress Core

Changeset 53833


Ignore:
Timestamp:
08/04/2022 05:18:36 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Correct data providers for get_term_link() and get_edit_term_link() tests.

  • The tests use named data providers which include a flag for passing either a term ID or term object to the test, but the values for the flag were the opposite of what the array key says.
  • Some array keys were duplicated, which means the earlier test case with the same name did not actually run.

Follow-up to [52180], [52255], [52258], [52305].

See #55652.

Location:
trunk/tests/phpunit/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/link/editTermLink.php

    r52305 r53833  
    119119        public function data_edit_term_link() {
    120120                return array(
    121                         'category passing term_id'          => array(
     121                        'category passing term_id'              => array(
     122                                'taxonomy' => 'category',
     123                                'use_id'   => true,
     124                                'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
     125                        ),
     126                        'category passing term object'          => array(
    122127                                'taxonomy' => 'category',
    123128                                'use_id'   => false,
    124129                                'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
    125130                        ),
    126                         'category passing term object'      => array(
    127                                 'taxonomy' => 'category',
     131                        'post_tag passing term_id'              => array(
     132                                'taxonomy' => 'post_tag',
    128133                                'use_id'   => true,
    129                                 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
     134                                'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
    130135                        ),
    131                         'post_tag passing term_id'          => array(
     136                        'post_tag passing term object'          => array(
    132137                                'taxonomy' => 'post_tag',
    133138                                'use_id'   => false,
    134139                                'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
    135140                        ),
    136                         'post_tag passing term object'      => array(
    137                                 'taxonomy' => 'post_tag',
     141                        'a custom taxonomy passing term_id'     => array(
     142                                'taxonomy' => 'custom_taxonomy',
    138143                                'use_id'   => true,
    139                                 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
     144                                'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    140145                        ),
    141                         'a custom taxonomy passing term_id' => array(
     146                        'a custom taxonomy passing term object' => array(
    142147                                'taxonomy' => 'custom_taxonomy',
    143148                                'use_id'   => false,
    144                                 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    145                         ),
    146                         'a custom taxonomy passing term_id' => array(
    147                                 'taxonomy' => 'custom_taxonomy',
    148                                 'use_id'   => true,
    149149                                'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    150150                        ),
  • trunk/tests/phpunit/tests/link/getEditTermLink.php

    r52305 r53833  
    119119        public function data_get_edit_term_link() {
    120120                return array(
    121                         'category passing term_id'          => array(
     121                        'category passing term_id'              => array(
     122                                'taxonomy' => 'category',
     123                                'use_id'   => true,
     124                                'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
     125                        ),
     126                        'category passing term object'          => array(
    122127                                'taxonomy' => 'category',
    123128                                'use_id'   => false,
    124129                                'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
    125130                        ),
    126                         'category passing term object'      => array(
    127                                 'taxonomy' => 'category',
     131                        'post_tag passing term_id'              => array(
     132                                'taxonomy' => 'post_tag',
    128133                                'use_id'   => true,
    129                                 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post',
     134                                'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
    130135                        ),
    131                         'post_tag passing term_id'          => array(
     136                        'post_tag passing term object'          => array(
    132137                                'taxonomy' => 'post_tag',
    133138                                'use_id'   => false,
    134139                                'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
    135140                        ),
    136                         'post_tag passing term object'      => array(
    137                                 'taxonomy' => 'post_tag',
     141                        'a custom taxonomy passing term_id'     => array(
     142                                'taxonomy' => 'custom_taxonomy',
    138143                                'use_id'   => true,
    139                                 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post',
     144                                'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    140145                        ),
    141                         'a custom taxonomy passing term_id' => array(
     146                        'a custom taxonomy passing term object' => array(
    142147                                'taxonomy' => 'custom_taxonomy',
    143148                                'use_id'   => false,
    144                                 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    145                         ),
    146                         'a custom taxonomy passing term_id' => array(
    147                                 'taxonomy' => 'custom_taxonomy',
    148                                 'use_id'   => true,
    149149                                'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    150150                        ),
  • trunk/tests/phpunit/tests/term/getTermLink.php

    r52305 r53833  
    295295        public function data_get_term_link() {
    296296                return array(
    297                         'category passing term_id'          => array(
     297                        'category passing term_id'              => array(
     298                                'taxonomy' => 'category',
     299                                'use_id'   => true,
     300                        ),
     301                        'category passing term object'          => array(
    298302                                'taxonomy' => 'category',
    299303                                'use_id'   => false,
    300304                        ),
    301                         'category passing term object'      => array(
    302                                 'taxonomy' => 'category',
     305                        'post_tag passing term_id'              => array(
     306                                'taxonomy' => 'post_tag',
    303307                                'use_id'   => true,
    304308                        ),
    305                         'post_tag passing term_id'          => array(
     309                        'post_tag passing term object'          => array(
    306310                                'taxonomy' => 'post_tag',
    307311                                'use_id'   => false,
    308312                        ),
    309                         'post_tag passing term object'      => array(
    310                                 'taxonomy' => 'post_tag',
     313                        'a custom taxonomy passing term_id'     => array(
     314                                'taxonomy' => 'wptests_tax',
    311315                                'use_id'   => true,
    312316                        ),
    313                         'a custom taxonomy passing term_id' => array(
     317                        'a custom taxonomy passing term object' => array(
    314318                                'taxonomy' => 'wptests_tax',
    315319                                'use_id'   => false,
    316                         ),
    317                         'a custom taxonomy passing term_id' => array(
    318                                 'taxonomy' => 'wptests_tax',
    319                                 'use_id'   => true,
    320                                 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post',
    321320                        ),
    322321                );
Note: See TracChangeset for help on using the changeset viewer.