Changeset 31359 for trunk/tests/phpunit/tests/admin/includesPost.php
- Timestamp:
- 02/06/2015 08:31:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPost.php
r31323 r31359 138 138 139 139 /** 140 * @ticket 30615 141 */ 142 public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() { 143 $u = $this->factory->user->create( array( 'role' => 'editor' ) ); 144 wp_set_current_user( $u ); 145 146 register_taxonomy( 'wptests_tax', array( 'post' ) ); 147 $t1 = $this->factory->term->create( array( 148 'taxonomy' => 'wptests_tax', 149 'name' => 'foo', 150 'slug' => 'bar', 151 ) ); 152 $t2 = $this->factory->term->create( array( 153 'taxonomy' => 'wptests_tax', 154 'name' => 'bar', 155 'slug' => 'foo', 156 ) ); 157 158 $p = $this->factory->post->create(); 159 160 $post_data = array( 161 'post_ID' => $p, 162 'tax_input' => array( 163 'wptests_tax' => 'foo,baz', 164 ), 165 ); 166 167 edit_post( $post_data ); 168 169 $found = wp_get_post_terms( $p, 'wptests_tax' ); 170 171 // Should contain the term with the name 'foo', not the slug. 172 $this->assertContains( $t1, wp_list_pluck( $found, 'term_id' ) ); 173 174 // The 'baz' tag should have been created. 175 $this->assertContains( 'baz', wp_list_pluck( $found, 'name' ) ); 176 } 177 178 /** 140 179 * @ticket 27792 141 180 */
Note: See TracChangeset
for help on using the changeset viewer.