WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/14/2015 09:23:03 PM (5 years ago)
Author:
boonebgorges
Message:

Create fewer fixtures in some tests.

See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/getPages.php

    r34699 r35162  
    1616        global $wpdb;
    1717
    18         $this->factory->post->create_many( 15, array( 'post_type' => 'page' ) );
     18        $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
    1919        wp_cache_delete( 'last_changed', 'posts' );
    2020        $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
    2121
    2222        $pages = get_pages();
    23         $this->assertEquals( 15, count( $pages ) );
     23        $this->assertEquals( 3, count( $pages ) );
    2424        $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) );
    2525        $num_queries = $wpdb->num_queries;
     
    2929        // Again. num_queries and last_changed should remain the same.
    3030        $pages = get_pages();
    31         $this->assertEquals( 15, count( $pages ) );
     31        $this->assertEquals( 3, count( $pages ) );
    3232        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    3333        $this->assertEquals( $num_queries, $wpdb->num_queries );
     
    3737        // Again with different args. last_changed should not increment because of
    3838        // different args to get_pages(). num_queries should bump by 1.
    39         $pages = get_pages( array( 'number' => 10 ) );
    40         $this->assertEquals( 10, count( $pages ) );
     39        $pages = get_pages( array( 'number' => 2 ) );
     40        $this->assertEquals( 2, count( $pages ) );
    4141        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    4242        $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
     
    4747
    4848        // Again. num_queries and last_changed should remain the same.
    49         $pages = get_pages( array( 'number' => 10 ) );
    50         $this->assertEquals( 10, count( $pages ) );
     49        $pages = get_pages( array( 'number' => 2 ) );
     50        $this->assertEquals( 2, count( $pages ) );
    5151        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    5252        $this->assertEquals( $num_queries, $wpdb->num_queries );
     
    5656        // Do the first query again. The interim queries should not affect it.
    5757        $pages = get_pages();
    58         $this->assertEquals( 15, count( $pages ) );
     58        $this->assertEquals( 3, count( $pages ) );
    5959        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    6060        $this->assertEquals( $num_queries, $wpdb->num_queries );
     
    6969
    7070        // last_changed bumped so num_queries should increment.
    71         $pages = get_pages( array( 'number' => 10 ) );
    72         $this->assertEquals( 10, count( $pages ) );
     71        $pages = get_pages( array( 'number' => 2 ) );
     72        $this->assertEquals( 2, count( $pages ) );
    7373        $this->assertEquals( $time2, wp_cache_get( 'last_changed', 'posts' ) );
    7474        $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
     
    8989        // num_queries should bump after wp_delete_post() bumps last_changed.
    9090        $pages = get_pages();
    91         $this->assertEquals( 14, count( $pages ) );
     91        $this->assertEquals( 2, count( $pages ) );
    9292        $this->assertEquals( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
    9393        $this->assertEquals( $num_queries + 1, $wpdb->num_queries );
Note: See TracChangeset for help on using the changeset viewer.