@@ 361-376 (lines=16) @@ | ||
358 | $this->assertCount( 1, $response->get_data() ); |
|
359 | } |
|
360 | ||
361 | public function test_get_items_sticky_query() { |
|
362 | $id1 = $this->post_id; |
|
363 | $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) ); |
|
364 | ||
365 | update_option( 'sticky_posts', array( $id2 ) ); |
|
366 | ||
367 | $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); |
|
368 | $request->set_param( 'sticky', true ); |
|
369 | ||
370 | $response = $this->server->dispatch( $request ); |
|
371 | $this->assertCount( 1, $response->get_data() ); |
|
372 | ||
373 | $posts = $response->get_data(); |
|
374 | $post = $posts[0]; |
|
375 | $this->assertEquals( $id2, $post['id'] ); |
|
376 | } |
|
377 | ||
378 | public function test_get_items_sticky_with_post__in_query() { |
|
379 | $id1 = $this->post_id; |
|
@@ 407-422 (lines=16) @@ | ||
404 | $this->assertEquals( $id1, $post['id'] ); |
|
405 | } |
|
406 | ||
407 | public function test_get_items_not_sticky_query() { |
|
408 | $id1 = $this->post_id; |
|
409 | $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) ); |
|
410 | ||
411 | update_option( 'sticky_posts', array( $id2 ) ); |
|
412 | ||
413 | $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); |
|
414 | $request->set_param( 'sticky', false ); |
|
415 | ||
416 | $response = $this->server->dispatch( $request ); |
|
417 | $this->assertCount( 1, $response->get_data() ); |
|
418 | ||
419 | $posts = $response->get_data(); |
|
420 | $post = $posts[0]; |
|
421 | $this->assertEquals( $id1, $post['id'] ); |
|
422 | } |
|
423 | ||
424 | public function test_get_items_sticky_with_post__not_in_query() { |
|
425 | $id1 = $this->post_id; |