Make WordPress Core

Ticket #20376: 20376.tests.diff

File 20376.tests.diff, 1.3 KB (added by kovshenin, 12 years ago)
  • tests/post/getPages.php

     
    9292                foreach ( $pages as $page )
    9393                        $this->assertInstanceOf( 'WP_Post', $page );
    9494        }
     95
     96        /**
     97         * @ticket 20376
     98         */
     99        function test_get_pages_meta() {
     100                $posts = $this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     101                add_post_meta( $posts[0], 'some-meta-key', '0' );
     102                add_post_meta( $posts[1], 'some-meta-key', '' );
     103                add_post_meta( $posts[2], 'some-meta-key', '1' );
     104
     105                $this->assertEquals( count( get_pages( array(
     106                        'meta_key' => 'some-meta-key',
     107                        'meta_value' => '0',
     108                ) ) ), 1 );
     109
     110                $this->assertEquals( count( get_pages( array(
     111                        'meta_key' => 'some-meta-key',
     112                        'meta_value' => '1',
     113                ) ) ), 1 );
     114
     115                $this->assertEquals( count( get_pages( array(
     116                        'meta_key' => 'some-meta-key',
     117                ) ) ), 3 );
     118        }
     119
     120        /**
     121         * @ticket 22389
     122         */
     123        function test_wp_dropdown_pages() {
     124                $posts = $this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     125
     126                $matches = array();
     127                preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches );
     128
     129                $this->assertEquals( count( $matches[0] ), 5 );
     130        }
    95131}
     132 No newline at end of file