Make WordPress Core

Ticket #41797: class-wp-user-query-test.patch

File class-wp-user-query-test.patch, 1.1 KB (added by birgire, 8 years ago)
  • tests/phpunit/tests/user/query.php

     
    14341434                /* must not include user that has same string in other fields */
    14351435                $this->assertEquals( array(), $ids );
    14361436        }
     1437
     1438        /**
     1439         * @ticket 41797
     1440         */
     1441        public function test_max_num_pages() {
     1442
     1443                $q = new WP_User_Query( array(
     1444                        'role'          => 'author',
     1445                        'number'        => 3,
     1446                ) );
     1447
     1448                $this->assertEquals( 4, $q->get_total() );
     1449                $this->assertEquals( 2, $q->max_num_pages );
     1450        }
     1451
     1452        /**
     1453         * @ticket 41797
     1454         */
     1455        public function test_max_num_pages_should_be_zero_for_count_total_false_and_number_positive() {
     1456
     1457                $q = new WP_User_Query( array(
     1458                        'count_total'   => false,
     1459                        'number'        => 1,
     1460       
     1461                ) );
     1462
     1463                $this->assertEquals( 0, $q->max_num_pages );
     1464        }
     1465
     1466        /**
     1467         * @ticket 41797
     1468         */
     1469        public function test_max_num_pages_should_be_zero_for_count_total_true_and_no_number_set() {
     1470
     1471                $q = new WP_User_Query( array(
     1472                        'count_total'   => true,
     1473                ) );
     1474
     1475                $this->assertEquals( 0, $q->max_num_pages );
     1476        }
     1477
     1478
     1479
    14371480}