From d1b3e1cfd4a786ed1ab70e3c91ffff05cc16cb0f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 4 Aug 2022 17:18:36 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@53833 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/link/editTermLink.php | 28 ++++++++++---------- tests/phpunit/tests/link/getEditTermLink.php | 28 ++++++++++---------- tests/phpunit/tests/term/getTermLink.php | 23 ++++++++-------- 3 files changed, 39 insertions(+), 40 deletions(-) diff --git a/tests/phpunit/tests/link/editTermLink.php b/tests/phpunit/tests/link/editTermLink.php index 906014f067..b55cab5f75 100644 --- a/tests/phpunit/tests/link/editTermLink.php +++ b/tests/phpunit/tests/link/editTermLink.php @@ -118,34 +118,34 @@ class Tests_Link_EditTermLink extends WP_UnitTestCase { */ public function data_edit_term_link() { return array( - 'category passing term_id' => array( - 'taxonomy' => 'category', - 'use_id' => false, - 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', - ), - 'category passing term object' => array( + 'category passing term_id' => array( 'taxonomy' => 'category', 'use_id' => true, 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', ), - 'post_tag passing term_id' => array( - 'taxonomy' => 'post_tag', + 'category passing term object' => array( + 'taxonomy' => 'category', 'use_id' => false, - 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', + 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', ), - 'post_tag passing term object' => array( + 'post_tag passing term_id' => array( 'taxonomy' => 'post_tag', 'use_id' => true, 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', ), - 'a custom taxonomy passing term_id' => array( + 'post_tag passing term object' => array( + 'taxonomy' => 'post_tag', + 'use_id' => false, + 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', + ), + 'a custom taxonomy passing term_id' => array( 'taxonomy' => 'custom_taxonomy', - 'use_id' => false, + 'use_id' => true, 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post', ), - 'a custom taxonomy passing term_id' => array( + 'a custom taxonomy passing term object' => array( 'taxonomy' => 'custom_taxonomy', - 'use_id' => true, + 'use_id' => false, 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post', ), ); diff --git a/tests/phpunit/tests/link/getEditTermLink.php b/tests/phpunit/tests/link/getEditTermLink.php index 29a0466b24..3d1dd77da8 100644 --- a/tests/phpunit/tests/link/getEditTermLink.php +++ b/tests/phpunit/tests/link/getEditTermLink.php @@ -118,34 +118,34 @@ class Tests_Link_GetEditTermLink extends WP_UnitTestCase { */ public function data_get_edit_term_link() { return array( - 'category passing term_id' => array( - 'taxonomy' => 'category', - 'use_id' => false, - 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', - ), - 'category passing term object' => array( + 'category passing term_id' => array( 'taxonomy' => 'category', 'use_id' => true, 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', ), - 'post_tag passing term_id' => array( - 'taxonomy' => 'post_tag', + 'category passing term object' => array( + 'taxonomy' => 'category', 'use_id' => false, - 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', + 'expected' => 'term.php?taxonomy=category&tag_ID=%ID%&post_type=post', ), - 'post_tag passing term object' => array( + 'post_tag passing term_id' => array( 'taxonomy' => 'post_tag', 'use_id' => true, 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', ), - 'a custom taxonomy passing term_id' => array( + 'post_tag passing term object' => array( + 'taxonomy' => 'post_tag', + 'use_id' => false, + 'expected' => 'term.php?taxonomy=post_tag&tag_ID=%ID%&post_type=post', + ), + 'a custom taxonomy passing term_id' => array( 'taxonomy' => 'custom_taxonomy', - 'use_id' => false, + 'use_id' => true, 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post', ), - 'a custom taxonomy passing term_id' => array( + 'a custom taxonomy passing term object' => array( 'taxonomy' => 'custom_taxonomy', - 'use_id' => true, + 'use_id' => false, 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post', ), ); diff --git a/tests/phpunit/tests/term/getTermLink.php b/tests/phpunit/tests/term/getTermLink.php index 3522464cd1..61a4d08b7f 100644 --- a/tests/phpunit/tests/term/getTermLink.php +++ b/tests/phpunit/tests/term/getTermLink.php @@ -294,30 +294,29 @@ class Tests_Term_GetTermLink extends WP_UnitTestCase { */ public function data_get_term_link() { return array( - 'category passing term_id' => array( - 'taxonomy' => 'category', - 'use_id' => false, - ), - 'category passing term object' => array( + 'category passing term_id' => array( 'taxonomy' => 'category', 'use_id' => true, ), - 'post_tag passing term_id' => array( - 'taxonomy' => 'post_tag', + 'category passing term object' => array( + 'taxonomy' => 'category', 'use_id' => false, ), - 'post_tag passing term object' => array( + 'post_tag passing term_id' => array( 'taxonomy' => 'post_tag', 'use_id' => true, ), - 'a custom taxonomy passing term_id' => array( - 'taxonomy' => 'wptests_tax', + 'post_tag passing term object' => array( + 'taxonomy' => 'post_tag', 'use_id' => false, ), - 'a custom taxonomy passing term_id' => array( + 'a custom taxonomy passing term_id' => array( 'taxonomy' => 'wptests_tax', 'use_id' => true, - 'expected' => 'term.php?taxonomy=custom_taxonomy&tag_ID=%ID%&post_type=post', + ), + 'a custom taxonomy passing term object' => array( + 'taxonomy' => 'wptests_tax', + 'use_id' => false, ), ); }