Changeset 54061 for trunk/tests/phpunit/tests/link/getEditTermLink.php
- Timestamp:
- 09/02/2022 01:14:29 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/getEditTermLink.php
r53836 r54061 43 43 * 44 44 * @param string $taxonomy Taxonomy being tested (used for index of term keys). 45 * @param bool $use_id Whe n true, pass term ID. Else, passterm object.46 * @return WP_Term|int If $use_id is true, term ID is returned; else instance of WP_Term.45 * @param bool $use_id Whether to return term ID or term object. 46 * @return WP_Term|int Term ID if `$use_id` is true, WP_Term instance otherwise. 47 47 */ 48 48 private function get_term( $taxonomy, $use_id ) { … … 146 146 * @ticket 50225 147 147 * 148 * @param string $taxonomy Taxonomy being tested (used for index of term keys).149 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.150 * @param string $expected Expected URL within admin ofedit link.151 */ 152 public function test_get_edit_term_link_ for_permitted_user( $taxonomy, $use_id, $expected ) {148 * @param string $taxonomy Taxonomy being tested. 149 * @param bool $use_id Whether to pass term ID or term object to `get_edit_term_link()`. 150 * @param string $expected Expected part of admin URL for the edit link. 151 */ 152 public function test_get_edit_term_link_should_return_the_link_for_permitted_user( $taxonomy, $use_id, $expected ) { 153 153 $term = $this->get_term( $taxonomy, $use_id ); 154 154 … … 158 158 159 159 $this->assertSame( $expected, get_edit_term_link( $term, $taxonomy ) ); 160 $this->assertSame( $expected, get_edit_term_link( get_term( $term, $taxonomy ), $taxonomy ) );161 160 } 162 161 … … 166 165 * @ticket 50225 167 166 * 168 * @param string $taxonomy Taxonomy being tested (used for index of term keys).169 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.170 */ 171 public function test_get_edit_term_link_ for_denied_user( $taxonomy, $use_id ) {167 * @param string $taxonomy Taxonomy being tested. 168 * @param bool $use_id Whether to pass term ID or term object to `get_edit_term_link()`. 169 */ 170 public function test_get_edit_term_link_should_return_null_for_denied_user( $taxonomy, $use_id ) { 172 171 wp_set_current_user( self::$user_ids['subscriber'] ); 173 172 $term = $this->get_term( $taxonomy, $use_id ); 174 173 175 174 $this->assertNull( get_edit_term_link( $term, $taxonomy ) ); 176 $this->assertNull( get_edit_term_link( get_term( $term, $taxonomy ), $taxonomy ) );177 175 } 178 176 … … 182 180 * @ticket 50225 183 181 * 184 * @param string $taxonomy Taxonomy being tested (used for index of term keys).185 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.186 */ 187 public function test_get_edit_term_link_filter_ is_int_by_term_id( $taxonomy, $use_id ) {182 * @param string $taxonomy Taxonomy being tested. 183 * @param bool $use_id Whether to pass term ID or term object to `get_edit_term_link()`. 184 */ 185 public function test_get_edit_term_link_filter_should_receive_term_id( $taxonomy, $use_id ) { 188 186 $term = $this->get_term( $taxonomy, $use_id ); 189 187 … … 201 199 202 200 /** 203 * @dataProvider data_get_edit_term_link204 *205 * @ticket 50225206 *207 * @param string $taxonomy Taxonomy being tested (used for index of term keys).208 * @param bool $use_id When true, pass term ID. Else, pass term object.209 */210 public function test_get_edit_term_link_filter_is_int_by_term_object( $taxonomy, $use_id ) {211 $term = $this->get_term( $taxonomy, $use_id );212 213 add_filter(214 'get_edit_term_link',215 function( $location, $term ) {216 $this->assertIsInt( $term );217 },218 10,219 2220 );221 222 get_edit_term_link( get_term( $term, $taxonomy ), $taxonomy );223 }224 225 /**226 201 * Data provider. 227 202 *
Note: See TracChangeset
for help on using the changeset viewer.