WordPress.org

Make WordPress Core

Ticket #37580: 37580-unit-test.diff

File 37580-unit-test.diff, 1.1 KB (added by JakePT, 3 years ago)
  • tests/phpunit/tests/user/mapMetaCap.php

     
    255255                $this->assertEquals( array( 'delete_others_posts', 'delete_published_posts' ), map_meta_cap( 'delete_post', $editor, $post_id ) );
    256256
    257257        }
     258
     259        /**
     260         * Test Front page.
     261         *
     262         * @ticket 37580
     263         */
     264        function test_delete_page_on_front() {
     265                $post_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_status' => 'publish' ) );
     266
     267                update_option( 'page_on_front', $post_id );
     268                $this->assertEquals( array( 'manage_options' ), map_meta_cap( 'delete_page', $this->user_id, $post_id ) );
     269        }
     270
     271        /**
     272         * Test Posts page.
     273         *
     274         * @ticket 37580
     275         */
     276        function test_delete_page_for_posts() {
     277                $post_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_status' => 'publish' ) );
     278
     279                update_option( 'page_for_posts', $post_id );
     280                $this->assertEquals( array( 'manage_options' ), map_meta_cap( 'delete_page', $this->user_id, $post_id ) );
     281        }
    258282}