Ticket #11892: 11892.2.patch
File 11892.2.patch, 1.5 KB (added by , 15 years ago) |
---|
-
wp-testcase/test_user_capabilities.php
122 122 // a role that doesn't exist 123 123 function test_bogus_role() { 124 124 _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 126 129 $user = new WP_User($id); 127 130 128 131 // user has no role and no capabilities 129 132 $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')); 132 134 } 133 135 134 136 // a user with multiple roles -
wp-testlib/utils.php
307 307 _default_wp_die_handler( $message, $title, $args ); 308 308 } else { 309 309 //Ignore at our peril 310 $GLOBALS['_wp_die_disabled_died'] = true; 310 311 } 311 312 } 312 313 313 314 function _disable_wp_die() { 314 $GLOBALS['_wp_die_disabled'] = true; 315 $GLOBALS['_wp_die_disabled'] = true; 316 $GLOBALS['_wp_die_disabled_died'] = false; 315 317 } 316 318 317 function _enable_wp_die() { 319 function _enable_wp_die() { 318 320 $GLOBALS['_wp_die_disabled'] = false; 321 return $GLOBALS['_wp_die_disabled_died']; 319 322 } 320 323 321 324 function _wp_die_handler_filter() {