Make WordPress Core


Ignore:
Timestamp:
10/14/2015 09:23:03 PM (8 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.php

    r34810 r35162  
    805805        $post_type = rand_str(20);
    806806        register_post_type( $post_type );
    807         $this->factory->post->create_many( 10, array(
     807        $this->factory->post->create_many( 3, array(
    808808            'post_type' => $post_type,
    809809            'post_author' => $this->author_id
    810810        ) );
    811811        $count1 = wp_count_posts( $post_type, 'readable' );
    812         $this->assertEquals( 10, $count1->publish );
     812        $this->assertEquals( 3, $count1->publish );
    813813        add_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) );
    814814
    815815        $count2 = wp_count_posts( $post_type, 'readable' );
    816         $this->assertEquals( 7, $count2->publish );
     816        $this->assertEquals( 2, $count2->publish );
    817817
    818818        remove_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) );
     
    820820
    821821    function filter_wp_count_posts( $counts ) {
    822         $counts->publish = 7;
     822        $counts->publish = 2;
    823823        return $counts;
    824824    }
    825825
    826826    function test_wp_count_posts_insert_invalidation() {
    827         $post_ids = $this->factory->post->create_many( 10 );
     827        $post_ids = $this->factory->post->create_many( 3 );
    828828        $initial_counts = wp_count_posts();
    829829
     
    838838        $after_draft_counts = wp_count_posts();
    839839        $this->assertEquals( 1, $after_draft_counts->draft );
    840         $this->assertEquals( 9, $after_draft_counts->publish );
     840        $this->assertEquals( 2, $after_draft_counts->publish );
    841841        $this->assertNotEquals( $initial_counts->publish, $after_draft_counts->publish );
    842842    }
    843843
    844844    function test_wp_count_posts_trash_invalidation() {
    845         $post_ids = $this->factory->post->create_many( 10 );
     845        $post_ids = $this->factory->post->create_many( 3 );
    846846        $initial_counts = wp_count_posts();
    847847
     
    856856        $after_trash_counts = wp_count_posts();
    857857        $this->assertEquals( 1, $after_trash_counts->trash );
    858         $this->assertEquals( 9, $after_trash_counts->publish );
     858        $this->assertEquals( 2, $after_trash_counts->publish );
    859859        $this->assertNotEquals( $initial_counts->publish, $after_trash_counts->publish );
    860860    }
Note: See TracChangeset for help on using the changeset viewer.