Changeset 45813
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php
r45811 r45813 211 211 212 212 if ( in_array( 'types', $fields, true ) ) { 213 $data['types'] = $taxonomy->object_type;213 $data['types'] = array_values( $taxonomy->object_type ); 214 214 } 215 215 -
trunk/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
r43571 r45813 194 194 array_keys( $response->get_data() ) 195 195 ); 196 } 197 198 public function test_object_types_is_an_array_if_object_type_is_unregistered() { 199 register_taxonomy_for_object_type( 'category', 'page' ); 200 register_taxonomy_for_object_type( 'category', 'attachment' ); 201 unregister_taxonomy_for_object_type( 'category', 'page' ); 202 203 $request = new WP_REST_Request( 'GET', '/wp/v2/taxonomies/category' ); 204 $response = rest_get_server()->dispatch( $request ); 205 206 $types = $response->get_data()['types']; 207 $this->assertArrayHasKey( 0, $types ); 208 $this->assertEquals( 'post', $types[0] ); 209 $this->assertArrayHasKey( 1, $types ); 210 $this->assertEquals( 'attachment', $types[1] ); 196 211 } 197 212
Note: See TracChangeset
for help on using the changeset viewer.