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
This commit is contained in:
Sergey Biryukov
2022-08-04 17:18:36 +00:00
parent 13e076e6a4
commit d1b3e1cfd4
3 changed files with 39 additions and 40 deletions

View File

@@ -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',
),
);

View File

@@ -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',
),
);

View File

@@ -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,
),
);
}