Make WordPress Core

Changeset 1033 in tests


Ignore:
Timestamp:
09/21/2012 10:15:22 AM (14 years ago)
Author:
westi
Message:

XMLRPC: Add some simple test cases for supporting searching in wp.getPosts. See #WP21623

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/xmlrpc/wp/getPosts.php

    r904 r1033  
    128128                }
    129129        }
     130
     131        /**
     132         * @ticket 21623
     133         */
     134        function test_search() {
     135                $this->make_user_by_role( 'editor' );
     136
     137                $post_ids[] = $this->factory->post->create( array( 'post_title' => 'First: ' . rand_str() ) );
     138                $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Second: ' . rand_str() ) );
     139
     140                // Search for none of them
     141                $filter = array( 's' => rand_str() );
     142                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
     143                $this->assertNotInstanceOf( 'IXR_Error', $results );
     144                $this->assertEquals( 0, count( $results ) );
     145
     146                // Search for one of them
     147                $filter = array( 's' => 'First:' );
     148                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
     149                $this->assertNotInstanceOf( 'IXR_Error', $results );
     150                $this->assertEquals( 1, count( $results ) );
     151        }
     152
    130153}
Note: See TracChangeset for help on using the changeset viewer.