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
This commit is contained in:
parent
289e9473df
commit
8b564b6106
|
@ -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() {
|
public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified() {
|
||||||
register_taxonomy( 'wptests_tax_subscriber', 'post', array(
|
register_taxonomy( 'wptests_tax_subscriber', 'post', array(
|
||||||
'manage_terms' => 'read',
|
'capabilities' => array(
|
||||||
|
'edit_terms' => 'read',
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$t = self::factory()->term->create( array(
|
$t = self::factory()->term->create( array(
|
||||||
'taxonomy' => 'wptests_tax',
|
'taxonomy' => 'wptests_tax_subscriber',
|
||||||
'name' => 'foo',
|
'name' => 'foo',
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
@ -82,6 +84,6 @@ class Tests_Term_GetEditTermLink extends WP_UnitTestCase {
|
||||||
wp_set_current_user( $u );
|
wp_set_current_user( $u );
|
||||||
|
|
||||||
$actual = get_edit_term_link( $t );
|
$actual = get_edit_term_link( $t );
|
||||||
$this->assertNull( $actual );
|
$this->assertNotNull( $actual );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue