Make WordPress Core

Ticket #24803: 24803.test.diff

File 24803.test.diff, 756 bytes (added by johnpbloch, 11 years ago)

Unit test

  • tests/post.php

     
    694694                $this->assertEquals( 1, $numpages );
    695695                $this->assertEquals( array( 'Page 0' ), $pages );
    696696        }
    697 }
    698  No newline at end of file
     697
     698        function test_wp_count_posts() {
     699                global $wp_post_types;
     700
     701                register_post_type( 'wp_count' );
     702                $this->factory->post->create( array(
     703                        'post_type' => 'wp_count',
     704                        'post_author' => $this->author_id
     705                ) );
     706                $count = wp_count_posts( 'wp_count', 'readable' );
     707                $this->assertEquals( 1, $count->publish );
     708                unset( $wp_post_types['wp_count'] );
     709                $this->assertEquals( new stdClass, wp_count_posts( 'wp_count', 'readable' ) );
     710        }
     711}