Changeset 54061 for trunk/tests/phpunit/tests/link/editTermLink.php
- Timestamp:
- 09/02/2022 01:14:29 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/link/editTermLink.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/link/editTermLink.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 ) { … … 60 60 * @ticket 50225 61 61 * 62 * @param string $taxonomy Taxonomy being tested (used for index of term keys).63 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.64 * @param string $expected Expected URL within admin ofedit link.62 * @param string $taxonomy Taxonomy being tested. 63 * @param bool $use_id Whether to pass term ID or term object to `edit_term_link()`. 64 * @param string $expected Expected part of admin URL for the edit link. 65 65 */ 66 public function test_edit_term_link_ for_permitted_user( $taxonomy, $use_id, $expected ) {66 public function test_edit_term_link_should_return_the_link_for_permitted_user( $taxonomy, $use_id, $expected ) { 67 67 $term = $this->get_term( $taxonomy, $use_id ); 68 68 … … 72 72 73 73 $this->assertStringContainsString( $expected, edit_term_link( '', '', '', $term, false ) ); 74 $this->assertStringContainsString( $expected, edit_term_link( '', '', '', get_term( $term, $taxonomy ), false ) );75 74 } 76 75 … … 80 79 * @ticket 50225 81 80 * 82 * @param string $taxonomy Taxonomy being tested (used for index of term keys).83 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.81 * @param string $taxonomy Taxonomy being tested. 82 * @param bool $use_id Whether to pass term ID or term object to `edit_term_link()`. 84 83 */ 85 public function test_edit_term_link_ for_denied_user( $taxonomy, $use_id ) {84 public function test_edit_term_link_should_return_null_for_denied_user( $taxonomy, $use_id ) { 86 85 wp_set_current_user( self::$user_ids['subscriber'] ); 87 86 $term = $this->get_term( $taxonomy, $use_id ); 88 87 89 88 $this->assertNull( edit_term_link( '', '', '', $term, false ) ); 90 $this->assertNull( edit_term_link( '', '', '', get_term( $term, $taxonomy ), false ) );91 89 } 92 90 … … 96 94 * @ticket 50225 97 95 * 98 * @param string $taxonomy Taxonomy being tested (used for index of term keys).99 * @param bool $use_id Whe n true, pass term ID. Else, pass term object.96 * @param string $taxonomy Taxonomy being tested. 97 * @param bool $use_id Whether to pass term ID or term object to `edit_term_link()`. 100 98 */ 101 public function test_edit_term_link_filter_ is_int_by_term_id( $taxonomy, $use_id ) {99 public function test_edit_term_link_filter_should_receive_term_id( $taxonomy, $use_id ) { 102 100 $term = $this->get_term( $taxonomy, $use_id ); 103 101 … … 112 110 113 111 edit_term_link( '', '', '', $term, false ); 114 }115 116 /**117 * @dataProvider data_edit_term_link118 *119 * @ticket 50225120 *121 * @param string $taxonomy Taxonomy being tested (used for index of term keys).122 * @param bool $use_id When true, pass term ID. Else, pass term object.123 */124 public function test_edit_term_link_filter_is_int_by_term_object( $taxonomy, $use_id ) {125 $term = $this->get_term( $taxonomy, $use_id );126 127 add_filter(128 'edit_term_link',129 function( $location, $term ) {130 $this->assertIsInt( $term );131 },132 10,133 2134 );135 136 edit_term_link( '', '', '', get_term( $term, $taxonomy ), false );137 112 } 138 113
Note: See TracChangeset
for help on using the changeset viewer.