| | 208 | * @ticket 41293 |
| | 209 | */ |
| | 210 | public function test_wp_get_post_terms_should_allow_same_args_with_the_get_terms() { |
| | 211 | wp_set_current_user( self::$editor_id ); |
| | 212 | |
| | 213 | register_taxonomy( 'wptests_tax', array( 'post' ) ); |
| | 214 | $t1 = self::factory()->term->create( array( |
| | 215 | 'taxonomy' => 'wptests_tax', |
| | 216 | 'name' => 'foo', |
| | 217 | 'slug' => 'bar', |
| | 218 | ) ); |
| | 219 | $t2 = self::factory()->term->create( array( |
| | 220 | 'taxonomy' => 'wptests_tax', |
| | 221 | 'name' => 'bar', |
| | 222 | 'slug' => 'foo', |
| | 223 | ) ); |
| | 224 | |
| | 225 | $post_data = array( |
| | 226 | 'post_ID' => self::$post_id, |
| | 227 | 'tax_input' => array( |
| | 228 | 'wptests_tax' => 'foo,baz', |
| | 229 | ), |
| | 230 | ); |
| | 231 | |
| | 232 | edit_post( $post_data ); |
| | 233 | |
| | 234 | $expect = wp_get_post_terms( self::$post_id, 'wptests_tax', array( |
| | 235 | 'fields' => 'ids', |
| | 236 | ) ); |
| | 237 | |
| | 238 | $found1 = array_keys( wp_get_post_terms( self::$post_id, 'wptests_tax', array( |
| | 239 | 'fields' => 'id=>parent', |
| | 240 | ) ) ); |
| | 241 | |
| | 242 | $found2 = array_keys( wp_get_post_terms( self::$post_id, 'wptests_tax', array( |
| | 243 | 'fields' => 'id=>slug', |
| | 244 | ) ) ); |
| | 245 | |
| | 246 | $found3 = array_keys( wp_get_post_terms( self::$post_id, 'wptests_tax', array( |
| | 247 | 'fields' => 'id=>name', |
| | 248 | ) ) ); |
| | 249 | |
| | 250 | $this->assertSame( $expect, $found1 ); |
| | 251 | $this->assertSame( $expect, $found2 ); |
| | 252 | $this->assertSame( $expect, $found3 ); |
| | 253 | } |
| | 254 | |
| | 255 | /** |