WordPress.org

Make WordPress Core

Changeset 730 in tests


Ignore:
Timestamp:
05/30/12 16:06:26 (23 months ago)
Author:
nacin
Message:

Meta cap tests: Use full user objects, that way we can make one of them a super admin, so test_file_edit_caps_not_reliant_on_unfiltered_html_constant() will not fail with a do_not_allow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_capabilities.php

    r689 r730  
    22 
    33class TestMapMetaCap extends WPTestCase { 
     4    var $super_admins = null; 
     5 
    46    function setUp() { 
    57        parent::setUp(); 
    68 
     9        $this->user_ids = array(); 
     10 
     11        $this->user_id = $this->_make_user( 'administrator' ); 
     12        $this->author_id = $this->_make_user( 'administrator' ); 
     13 
     14        if ( isset( $GLOBALS['super_admins'] ) ) 
     15            $this->super_admins = $GLOBALS['super_admins']; 
     16        $user = new WP_User( $this->user_id ); 
     17        $GLOBALS['super_admins'] = array( $user->user_login ); 
     18 
    719        $this->post_type = rand_str( 20 ); 
    820        register_post_type( $this->post_type ); 
    9  
    10         $this->user_id = 1; 
    11         $this->author_id = $this->user_id + 1; 
    1221 
    1322        $this->post_id = wp_insert_post( array( 
     
    1726            'post_author' => $this->author_id, 
    1827        ) ); 
    19  
    2028    } 
    2129 
     
    2331        parent::tearDown(); 
    2432        wp_delete_post( $this->post_id, true ); 
     33 
     34        $GLOBALS['super_admins'] = $this->super_admins; 
     35 
     36        $this->_destroy_users(); 
    2537    } 
    2638 
Note: See TracChangeset for help on using the changeset viewer.