- Timestamp:
- 10/27/2016 01:41:08 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r38960 r38974 771 771 } 772 772 773 /** 774 * @ticket 38504 775 */ 776 public function test_object_term_queries_are_cached() { 777 global $wpdb; 778 779 $tags = $this->factory->tag->create_many( 2 ); 780 $p = $this->factory->post->create(); 781 wp_set_object_terms( $p, $tags[0], 'post_tag' ); 782 783 $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); 784 $request->set_param( 'post', $p ); 785 $response = $this->server->dispatch( $request ); 786 $found_1 = wp_list_pluck( $response->data, 'id' ); 787 788 unset( $request, $response ); 789 790 $num_queries = $wpdb->num_queries; 791 792 $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); 793 $request->set_param( 'post', $p ); 794 $response = $this->server->dispatch( $request ); 795 $found_2 = wp_list_pluck( $response->data, 'id' ); 796 797 $this->assertEqualSets( $found_1, $found_2 ); 798 $this->assertSame( $num_queries, $wpdb->num_queries ); 799 } 800 773 801 public function additional_field_get_callback( $object, $request ) { 774 802 return 123;
Note: See TracChangeset
for help on using the changeset viewer.