Don't match partial roles in WP_User_Query.

Because 'role=ocean90' shouldn't match 'role=bocean901'.

Props bocean901, ocean90.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@35101 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-10-13 01:31:53 +00:00
parent d936110f7c
commit 9f551a4630
2 changed files with 24 additions and 3 deletions
+21
View File
@@ -955,6 +955,27 @@ class Tests_User_Query extends WP_UnitTestCase {
$this->assertEquals( 2, count( $users ) );
}
/**
* @ticket 22212
*/
public function test_get_single_role_by_string_which_is_similar() {
$editors = $this->factory->user->create_many( 2, array(
'role' => 'editor',
) );
$another_editor = $this->factory->user->create( array(
'role' => 'another-editor',
) );
$users = get_users( array(
'role' => 'editor',
'fields' => 'ids',
) );
$this->assertEqualSets( $editors, $users );
}
/**
* @ticket 22212
*/