Make WordPress Core


Ignore:
Timestamp:
07/09/2012 03:32:24 PM (14 years ago)
Author:
nacin
Message:

Convert knownWPBug and knownUTBug to @ticket annotations. fixes #102.

Allows for an extra description to be included with the annotation,
which will be passed to markTestSkipped().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_user_capabilities.php

    r828 r894  
    539539                $this->assertFalse($contributor->has_cap('delete_page', $page));
    540540        }
    541 
    542         function test_usermeta_caps() {
    543 
    544                 $this->knownWPBug(5541);
    545 
    546                 // make sure an old style usermeta capabilities entry is still recognized by the new code
    547 
    548                 $id = $this->factory->user->create( array( 'role' => 'author' ) );
    549                 $user = new WP_User($id);
    550                 $this->assertTrue($user->exists(), "Problem getting user $id");
    551 
    552                 global $wpdb;
    553                 if (!empty($wpdb->user_role))
    554                         $wpdb->query("DELETE FROM {$wpdb->user_role} WHERE user_id = {$id}");
    555 
    556                 update_usermeta($id, $user->cap_key, array('editor' => true));
    557 
    558                 $user = new WP_User($id);
    559                 $this->assertTrue($user->exists(), "Problem getting user $id");
    560 
    561                 // check a few of the main capabilities
    562                 $this->assertEquals(array('editor'), $user->roles);
    563                 $this->assertTrue($user->has_cap('moderate_comments'));
    564                 $this->assertTrue($user->has_cap('manage_categories'));
    565                 $this->assertTrue($user->has_cap('upload_files'));
    566                 $this->assertTrue($user->has_cap('level_7'));
    567 
    568                 // and a few capabilities this user doesn't have
    569                 $this->assertFalse($user->has_cap('switch_themes'));
    570                 $this->assertFalse($user->has_cap('edit_users'));
    571                 $this->assertFalse($user->has_cap('level_8'));
    572         }
    573 
    574         function _test_generate_role_thingy() {
    575                 global $wp_roles;
    576                 foreach (array_keys($wp_roles->roles) as $role) {
    577                         $obj = $wp_roles->role_objects[$role];
    578 
    579                         echo "\nadd_role('{$role}', '{$obj->name}', ".var_export($obj->capabilities, true)."\n";
    580                         echo ")\n";
    581                 }
    582         }
    583541}
Note: See TracChangeset for help on using the changeset viewer.