Make WordPress Core

Ticket #22212: query.php.patch

File query.php.patch, 842 bytes (added by barrykooij, 12 years ago)

Unit Test to test user.php.patch

  • tests/user/query.php

     
    7676                        $this->assertInstanceOf( 'WP_User', $user );
    7777                }
    7878        }
     79
     80        /**
     81         * @ticket 22212
     82         */
     83        function test_get_multiple_roles() {
     84                $this->factory->user->create_many( 2, array(
     85                        'role' => 'subscriber'
     86                ) );
     87
     88                $this->factory->user->create_many( 3, array(
     89                        'role' => 'editor'
     90                ) );
     91
     92                $this->factory->user->create_many( 2, array(
     93                        'role' => 'administrator'
     94                ) );
     95
     96                $users = new WP_User_Query( array( 'role' => array( 'subscriber', 'editor' ) ) );
     97                $users = $users->get_results();
     98
     99                $this->assertEquals( 5, count( $users ) );
     100                foreach ( $users as $user ) {
     101                        $this->assertInstanceOf( 'WP_User', $user );
     102                }
     103        }
    79104}