From 8b564b61069c5e1379bd5810332a376c13ca8ad7 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 14 Mar 2016 01:51:12 +0000 Subject: [PATCH] Fix test related to cap check in `get_edit_term_link()`. The test was introduced in [36646] was intended to demonstrate that the cap check in `get_edit_term_link()` uses the custom capability from the correct taxonomy when `$taxonomy` is not specified but must be inferred from the provided term. However, the test was wrongly written in pretty much every way. Antiprops boonebgorges. Props swissspidy. See #35922. git-svn-id: https://develop.svn.wordpress.org/trunk@36986 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/term/getEditTermLink.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/term/getEditTermLink.php b/tests/phpunit/tests/term/getEditTermLink.php index c0844b932d..8ebc49c756 100644 --- a/tests/phpunit/tests/term/getEditTermLink.php +++ b/tests/phpunit/tests/term/getEditTermLink.php @@ -68,11 +68,13 @@ class Tests_Term_GetEditTermLink extends WP_UnitTestCase { */ public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified() { register_taxonomy( 'wptests_tax_subscriber', 'post', array( - 'manage_terms' => 'read', + 'capabilities' => array( + 'edit_terms' => 'read', + ), ) ); $t = self::factory()->term->create( array( - 'taxonomy' => 'wptests_tax', + 'taxonomy' => 'wptests_tax_subscriber', 'name' => 'foo', ) ); @@ -82,6 +84,6 @@ class Tests_Term_GetEditTermLink extends WP_UnitTestCase { wp_set_current_user( $u ); $actual = get_edit_term_link( $t ); - $this->assertNull( $actual ); + $this->assertNotNull( $actual ); } }