| @@ 2480-2490 (lines=11) @@ | ||
| 2477 | /** |
|
| 2478 | * @ticket 8071 |
|
| 2479 | */ |
|
| 2480 | public function test_no_found_rows_should_default_to_true() |
|
| 2481 | { |
|
| 2482 | $comments = self::factory()->comment->create_many(3, array( 'comment_post_ID' => self::$post_id )); |
|
| 2483 | ||
| 2484 | $q = new WP_Comment_Query( |
|
| 2485 | array( |
|
| 2486 | 'post_id' => self::$post_id, |
|
| 2487 | 'number' => 2, |
|
| 2488 | ) |
|
| 2489 | ); |
|
| 2490 | ||
| 2491 | $this->assertEquals(0, $q->found_comments); |
|
| 2492 | $this->assertEquals(0, $q->max_num_pages); |
|
| 2493 | } |
|
| @@ 2498-2509 (lines=12) @@ | ||
| 2495 | /** |
|
| 2496 | * @ticket 8071 |
|
| 2497 | */ |
|
| 2498 | public function test_should_respect_no_found_rows_true() |
|
| 2499 | { |
|
| 2500 | $comments = self::factory()->comment->create_many(3, array( 'comment_post_ID' => self::$post_id )); |
|
| 2501 | ||
| 2502 | $q = new WP_Comment_Query( |
|
| 2503 | array( |
|
| 2504 | 'post_id' => self::$post_id, |
|
| 2505 | 'number' => 2, |
|
| 2506 | 'no_found_rows' => true, |
|
| 2507 | ) |
|
| 2508 | ); |
|
| 2509 | ||
| 2510 | $this->assertEquals(0, $q->found_comments); |
|
| 2511 | $this->assertEquals(0, $q->max_num_pages); |
|
| 2512 | } |
|
| @@ 2517-2528 (lines=12) @@ | ||
| 2514 | /** |
|
| 2515 | * @ticket 8071 |
|
| 2516 | */ |
|
| 2517 | public function test_should_respect_no_found_rows_false() |
|
| 2518 | { |
|
| 2519 | $comments = self::factory()->comment->create_many(3, array( 'comment_post_ID' => self::$post_id )); |
|
| 2520 | ||
| 2521 | $q = new WP_Comment_Query( |
|
| 2522 | array( |
|
| 2523 | 'post_id' => self::$post_id, |
|
| 2524 | 'number' => 2, |
|
| 2525 | 'no_found_rows' => false, |
|
| 2526 | ) |
|
| 2527 | ); |
|
| 2528 | ||
| 2529 | $this->assertEquals(3, $q->found_comments); |
|
| 2530 | $this->assertEquals(2, $q->max_num_pages); |
|
| 2531 | } |
|