function tearDown() { if (!is_null($this->_old_handler)) { restore_error_handler(); } _enable_wp_die(); }
function test_bogus_role() { _disable_wp_die(); $id = $this->factory->user->create( array( 'role' => rand_str() ) ); $user = new WP_User($id); $this->assertTrue($user->exists(), "Problem getting user $id"); // user has no role and no capabilities $this->assertEquals(array(), $user->roles); $this->assertFalse($user->has_cap('level_0')); _enable_wp_die(); }