Make WordPress Core

Changeset 1323 in tests for trunk/tests/post.php


Ignore:
Timestamp:
07/28/2013 09:35:18 PM (11 years ago)
Author:
nacin
Message:

Simple test for wp_count_posts(). props johnpbloch. see #16746.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post.php

    r1307 r1323  
    695695        $this->assertEquals( array( 'Page 0' ), $pages );
    696696    }
     697
     698    /**
     699     * @ticket 24803
     700     */
     701    function test_wp_count_posts() {
     702        $post_type = rand_str(20);
     703        register_post_type( $post_type );
     704        $this->factory->post->create( array(
     705            'post_type' => $post_type,
     706            'post_author' => $this->author_id
     707        ) );
     708        $count = wp_count_posts( $post_type, 'readable' );
     709        $this->assertEquals( 1, $count->publish );
     710        _unregister_post_type( $post_type );
     711        $this->assertEquals( new stdClass, wp_count_posts( $post_type, 'readable' ) );
     712    }
    697713}
Note: See TracChangeset for help on using the changeset viewer.