Make WordPress Core


Ignore:
Timestamp:
02/23/2016 08:06:25 PM (10 years ago)
Author:
boonebgorges
Message:

Make $taxonomy parameter optional in get_edit_term_link().

Props nicdford, sc0ttkclark.
Fixes #35922.

File:
1 edited

Legend:

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

    r36309 r36646  
    5151        }
    5252
     53        /**
     54         * @ticket 35922
     55         */
     56        public function test_taxonomy_should_not_be_required() {
     57                $t = self::factory()->term->create( array(
     58                        'taxonomy' => 'wptests_tax',
     59                        'name' => 'foo',
     60                ) );
    5361
     62                $actual = get_edit_term_link( $t );
     63                $this->assertNotNull( $actual );
     64        }
     65
     66        /**
     67         * @ticket 35922
     68         */
     69        public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified() {
     70                register_taxonomy( 'wptests_tax_subscriber', 'post', array(
     71                        'manage_terms' => 'read',
     72                ) );
     73
     74                $t = self::factory()->term->create( array(
     75                        'taxonomy' => 'wptests_tax',
     76                        'name' => 'foo',
     77                ) );
     78
     79                $u = self::factory()->user->create( array(
     80                        'role' => 'subscriber',
     81                ) );
     82                wp_set_current_user( $u );
     83
     84                $actual = get_edit_term_link( $t );
     85                $this->assertNull( $actual );
     86        }
    5487}
Note: See TracChangeset for help on using the changeset viewer.