Make WordPress Core

Changeset 376 in tests


Ignore:
Timestamp:
07/18/2011 08:25:38 PM (13 years ago)
Author:
ryan
Message:

Update meta tests

Location:
wp-testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_meta.php

    r374 r376  
    1414    }
    1515
    16     function _meta_auth_cb() {
    17         return true;
    18     }
    19 
    2016    function _meta_sanitize_cb ( $meta_value, $meta_key, $meta_type ) {
    2117        return 'sanitized';
     
    2925        $this->assertEquals( 'unsanitized', $meta );
    3026
    31         register_meta( 'some_meta', 'post', array( 'sanitize_callback' => array( &$this, '_meta_sanitize_cb' ) ) );
     27        register_meta( 'some_meta', 'post', array( &$this, '_meta_sanitize_cb' ) );
    3228        $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
    3329        $this->assertEquals( 'sanitized', $meta );
  • wp-testcase/test_user_capabilities.php

    r375 r376  
    3030    }
    3131
    32     function _meta_yes_you_can( $key, $post_id, $user_id, $cap ) {
     32    function _meta_yes_you_can( $can, $key, $post_id, $user_id, $cap, $caps ) {
    3333        return true;
    3434    }
    3535
    36     function _meta_no_you_cant( $key, $post_id, $user_id, $cap ) {
     36    function _meta_no_you_cant( $can, $key, $post_id, $user_id, $cap, $caps ) {
    3737        return false;
     38    }
     39
     40    function _meta_filter( $meta_value, $meta_key, $meta_type ) {
     41        return $meta_value;
    3842    }
    3943
     
    458462        if ( function_exists( 'register_meta') ) {
    459463            $this->assertTrue( $admin->has_cap('edit_post_meta',  $post) );
    460             $this->assertTrue( $admin->has_cap('create_post_meta',  $post) );
     464            $this->assertTrue( $admin->has_cap('add_post_meta',  $post) );
    461465            $this->assertTrue( $admin->has_cap('delete_post_meta',  $post) );
    462466
    463467            $this->assertFalse( $admin->has_cap('edit_post_meta', $post, '_protected') );
    464             $this->assertFalse( $admin->has_cap('create_post_meta', $post, '_protected') );
     468            $this->assertFalse( $admin->has_cap('add_post_meta', $post, '_protected') );
    465469            $this->assertFalse( $admin->has_cap('delete_post_meta', $post, '_protected') );
    466470
    467             register_meta( '_protected', 'post', array( 'auth_callback' => array( &$this, '_meta_yes_you_can' ) ) );
     471            register_meta( '_protected', 'post', array( &$this, '_meta_filter' ), array( &$this, '_meta_yes_you_can' ) );
    468472            $this->assertTrue( $admin->has_cap('edit_post_meta',  $post, '_protected') );
    469             $this->assertTrue( $admin->has_cap('create_post_meta',  $post, '_protected') );
     473            $this->assertTrue( $admin->has_cap('add_post_meta',  $post, '_protected') );
    470474            $this->assertTrue( $admin->has_cap('delete_post_meta',  $post, '_protected') );
    471475
    472476            $this->assertTrue( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
    473             $this->assertTrue( $admin->has_cap('create_post_meta', $post, 'not_protected') );
     477            $this->assertTrue( $admin->has_cap('add_post_meta', $post, 'not_protected') );
    474478            $this->assertTrue( $admin->has_cap('delete_post_meta', $post, 'not_protected') );
    475479
    476             register_meta( 'not_protected', 'post', array( 'auth_callback' => array( &$this, '_meta_no_you_cant') ) );
     480            register_meta( 'not_protected', 'post', array( &$this, '_meta_filter' ), array( &$this, '_meta_no_you_cant' ) );
    477481            $this->assertFalse( $admin->has_cap('edit_post_meta',  $post, 'not_protected') );
    478             $this->assertFalse( $admin->has_cap('create_post_meta',  $post, 'not_protected') );
     482            $this->assertFalse( $admin->has_cap('add_post_meta',  $post, 'not_protected') );
    479483            $this->assertFalse( $admin->has_cap('delete_post_meta',  $post, 'not_protected') );
    480484        }
Note: See TracChangeset for help on using the changeset viewer.