Make WordPress Core

Changeset 1279 in tests


Ignore:
Timestamp:
05/10/2013 06:42:23 PM (11 years ago)
Author:
SergeyBiryukov
Message:

get_pages() test for '0' as meta_value argument and a basic wp_dropdown_pages() test. props kovshenin. see #20376.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post/getPages.php

    r1208 r1279  
    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( 3, 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( 1, count( get_pages( array( 'meta_key' => 'some-meta-key', 'meta_value' => '0' ) ) ) );
     106        $this->assertEquals( 1, count( get_pages( array( 'meta_key' => 'some-meta-key', 'meta_value' => '1' ) ) ) );
     107        $this->assertEquals( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );
     108    }
     109
     110    /**
     111     * @ticket 22389
     112     */
     113    function test_wp_dropdown_pages() {
     114        $posts = $this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     115
     116        preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches );
     117
     118        $this->assertEquals( 5, count( $matches[0] ) );
     119    }
    95120}
Note: See TracChangeset for help on using the changeset viewer.