Changeset 39082 for trunk/tests/phpunit/tests/user/capabilities.php
- Timestamp:
- 11/02/2016 12:30:29 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/capabilities.php
r39035 r39082 42 42 unset($GLOBALS['wp_user_roles']); 43 43 global $wp_roles; 44 if ( is_object( $wp_roles ) ) 45 $wp_roles->_init(); 44 $wp_roles = new WP_Roles(); 46 45 } 47 46 … … 1627 1626 } 1628 1627 1628 protected $_role_test_wp_roles_role; 1629 /** 1630 * @ticket 23016 1631 */ 1632 public function test_wp_roles_init_action() { 1633 $this->_role_test_wp_roles_init = array( 1634 'role' => 'test_wp_roles_init', 1635 'info' => array( 1636 'name' => 'Test WP Roles Init', 1637 'capabilities' => array( 'testing_magic' => true ), 1638 ), 1639 ); 1640 add_action( 'wp_roles_init', array( $this, '_hook_wp_roles_init' ), 10, 1 ); 1641 1642 $wp_roles = new WP_Roles(); 1643 1644 remove_action( 'wp_roles_init', array( $this, '_hook_wp_roles_init' ) ); 1645 1646 $expected = new WP_Role( $this->_role_test_wp_roles_init['role'], $this->_role_test_wp_roles_init['info']['capabilities'] ); 1647 1648 $role = $wp_roles->get_role( $this->_role_test_wp_roles_init['role'] ); 1649 1650 $this->assertEquals( $expected, $role ); 1651 $this->assertContains( $this->_role_test_wp_roles_init['info']['name'], $wp_roles->role_names ); 1652 } 1653 1654 public function _hook_wp_roles_init( $wp_roles ) { 1655 $wp_roles->add_role( $this->_role_test_wp_roles_init['role'], $this->_role_test_wp_roles_init['info']['name'], $this->_role_test_wp_roles_init['info']['capabilities'] ); 1656 } 1629 1657 }
Note: See TracChangeset
for help on using the changeset viewer.