WordPress.org

Make WordPress Core

Ticket #20407: getTaxonomies-unittest.diff

File getTaxonomies-unittest.diff, 1.1 KB (added by markoheijnen, 6 years ago)

New unit test

  • wp-testcase/test-xmlrpc-api/test_wp_getTaxonomies.php

     
    88                $this->assertEquals( 403, $result->code );
    99        }
    1010
    11         function test_taxonomy_validated() {
    12                 $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor', 'category' ) );
     11        function test_incapable_user() {
     12                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'subscriber', 'subscriber' ) );
    1313                $this->assertNotInstanceOf( 'IXR_Error', $result );
     14                $this->assertEquals( 0, count( $result ) );
    1415        }
     16
     17        function test_public_taxonomies() {
     18                $filter = array( 'public' => true );
     19                $taxonomies = get_taxonomies( $filter, 'objects' );
     20
     21                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor', $filter ) );
     22                $this->assertNotInstanceOf( 'IXR_Error', $result );
     23                $this->assertEquals( count( $taxonomies ), count( $result ) );
     24        }
    1525}
     26 No newline at end of file