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/query/conditionals.php

    r34810 r35162  
    252252    // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
    253253    function test_paged() {
    254         $this->factory->post->create_many( 15 );
     254        update_option( 'posts_per_page', 2 );
     255        $this->factory->post->create_many( 5 );
    255256        for ( $i = 2; $i <= 3; $i++ ) {
    256257            $this->go_to("/page/{$i}/");
     
    305306    // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
    306307    function test_search_paged() {
    307         $this->factory->post->create_many( 10, array( 'post_title' => 'test' ) );
     308        update_option( 'posts_per_page', 2 );
     309        $this->factory->post->create_many( 3, array( 'post_title' => 'test' ) );
    308310        $this->go_to('/search/test/page/2/');
    309311        $this->assertQueryTrue('is_search', 'is_paged');
     
    345347    // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
    346348    function test_category_paged() {
    347         $this->factory->post->create_many( 10 );
     349        update_option( 'posts_per_page', 2 );
     350        $this->factory->post->create_many( 3 );
    348351        $this->go_to('/category/uncategorized/page/2/');
    349352        $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
     
    378381    // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
    379382    function test_tag_paged() {
    380         $post_ids = $this->factory->post->create_many( 10 );
     383        update_option( 'posts_per_page', 2 );
     384        $post_ids = $this->factory->post->create_many( 3 );
    381385        foreach ( $post_ids as $post_id )
    382386            $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
     
    424428    // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
    425429    function test_author_paged() {
     430        update_option( 'posts_per_page', 2 );
    426431        $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
    427         $this->factory->post->create_many( 10, array( 'post_author' => $user_id ) );
     432        $this->factory->post->create_many( 3, array( 'post_author' => $user_id ) );
    428433        $this->go_to('/author/user-a/page/2/');
    429434        $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
     
    465470    // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
    466471    function test_ymd_paged() {
    467         $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
     472        update_option( 'posts_per_page', 2 );
     473        $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    468474        $this->go_to('/2007/09/04/page/2/');
    469475        $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
     
    498504    // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
    499505    function test_ym_paged() {
    500         $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
     506        update_option( 'posts_per_page', 2 );
     507        $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    501508        $this->go_to('/2007/09/page/2/');
    502509        $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
     
    531538    // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
    532539    function test_y_paged() {
    533         $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
     540        update_option( 'posts_per_page', 2 );
     541        $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    534542        $this->go_to('/2007/page/2/');
    535543        $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
Note: See TracChangeset for help on using the changeset viewer.