WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/14/2015 04:43:48 AM (6 years ago)
Author:
wonderboymusic
Message:

Add sanity checks in map_meta_cap(), return 'do_not_allow' when posts don't exist.

Adds unit test.

Props ocean90, nerrad, filosofo.
Fixes #23162.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/mapMetaCap.php

    r31622 r34113  
    3636        unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
    3737        parent::tearDown();
     38    }
     39
     40    /**
     41     * @ticket 13905
     42     */
     43    function test_capability_type_post_with_invalid_id() {
     44        $this->assertEquals(
     45            array( 'do_not_allow' ),
     46            map_meta_cap( 'edit_post', $this->user_id, $this->post_id + 1 )
     47        );
    3848    }
    3949
Note: See TracChangeset for help on using the changeset viewer.