Ticket #11892: 11892.2.patch

File 11892.2.patch, 1.5 KB (added by hakre, 3 years ago)

Post-Commit Patch #1

  • wp-testcase/test_user_capabilities.php

     
    122122        // a role that doesn't exist 
    123123        function test_bogus_role() { 
    124124                _disable_wp_die(); 
    125                 $id = $this->_make_user(rand_str()); 
     125                $id   = $this->_make_user($role = rand_str()); 
     126                $died = _enable_wp_die(); 
     127                $this->assertTrue($died); // creating the user should have made the script died.                 
     128                                 
    126129                $user = new WP_User($id); 
    127130 
    128131                // user has no role and no capabilities 
    129132                $this->assertEquals(array(), $user->roles); 
    130                 $this->assertFalse($user->has_cap('level_0')); 
    131                 _enable_wp_die(); 
     133                $this->assertFalse($user->has_cap('level_0'));           
    132134        } 
    133135 
    134136        // a user with multiple roles 
  • wp-testlib/utils.php

     
    307307                _default_wp_die_handler( $message, $title, $args ); 
    308308        } else { 
    309309                //Ignore at our peril 
     310                $GLOBALS['_wp_die_disabled_died'] = true; 
    310311        } 
    311312} 
    312313 
    313314function _disable_wp_die() { 
    314         $GLOBALS['_wp_die_disabled'] = true; 
     315        $GLOBALS['_wp_die_disabled']      = true; 
     316        $GLOBALS['_wp_die_disabled_died'] = false; 
    315317} 
    316318 
    317 function _enable_wp_die() { 
     319function _enable_wp_die() {      
    318320        $GLOBALS['_wp_die_disabled'] = false; 
     321        return $GLOBALS['_wp_die_disabled_died']; 
    319322} 
    320323 
    321324function _wp_die_handler_filter() {