Make WordPress Core

Changeset 36986


Ignore:
Timestamp:
03/14/2016 01:51:12 AM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/getEditTermLink.php

    r36874 r36986  
    6969    public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified() {
    7070        register_taxonomy( 'wptests_tax_subscriber', 'post', array(
    71             'manage_terms' => 'read',
     71            'capabilities' => array(
     72                'edit_terms' => 'read',
     73            ),
    7274        ) );
    7375
    7476        $t = self::factory()->term->create( array(
    75             'taxonomy' => 'wptests_tax',
     77            'taxonomy' => 'wptests_tax_subscriber',
    7678            'name' => 'foo',
    7779        ) );
     
    8385
    8486        $actual = get_edit_term_link( $t );
    85         $this->assertNull( $actual );
     87        $this->assertNotNull( $actual );
    8688    }
    8789}
Note: See TracChangeset for help on using the changeset viewer.