Changeset 42855 for trunk/tests/phpunit/tests/user.php
- Timestamp:
- 03/19/2018 08:28:28 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/user.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user.php
r42343 r42855 1542 1542 $this->assertNotContains( ''Test' blog's "name" has <html entities> &', $email->subject, 'Email subject does contains HTML entities' ); 1543 1543 } 1544 1545 /** 1546 * @ticket 42564 1547 */ 1548 function test_edit_user_role_update() { 1549 $_POST = $_GET = $_REQUEST = array(); 1550 1551 $administrator = self::factory()->user->create( 1552 array( 1553 'role' => 'administrator', 1554 ) 1555 ); 1556 1557 wp_set_current_user( $administrator ); 1558 1559 // Don't let anyone with 'promote_users' (administrator) edit their own role to something without it (subscriber). 1560 $_POST['role'] = 'subscriber'; 1561 $_POST['email'] = 'subscriber@subscriber.test'; 1562 $_POST['nickname'] = 'subscriber'; 1563 $this->assertSame( $administrator, edit_user( $administrator ) ); 1564 1565 // Should still have the old role. 1566 $this->assertSame( array( 'administrator' ), get_userdata( $administrator )->roles ); 1567 1568 // Promote an editor to an administrator. 1569 $editor = self::factory()->user->create( 1570 array( 1571 'role' => 'editor', 1572 ) 1573 ); 1574 1575 $_POST['role'] = 'administrator'; 1576 $_POST['email'] = 'administrator@administrator.test'; 1577 $_POST['nickname'] = 'administrator'; 1578 $this->assertSame( $editor, edit_user( $editor ) ); 1579 1580 // Should have the new role. 1581 $this->assertSame( array( 'administrator' ), get_userdata( $editor )->roles ); 1582 } 1544 1583 }
Note: See TracChangeset
for help on using the changeset viewer.