WordPress.org

Make WordPress Core

Ticket #31935: 31935-unit-test.diff

File 31935-unit-test.diff, 953 bytes (added by salcode, 6 years ago)
  • tests/phpunit/tests/query/conditionals.php

    diff --git tests/phpunit/tests/query/conditionals.php tests/phpunit/tests/query/conditionals.php
    index 3c27388..3a6361e 100644
    class Tests_Query_Conditionals extends WP_UnitTestCase { 
    138138                }
    139139        }
    140140
     141        /**
     142         * @ticket 31935
     143         */
     144        function test_page_feed_for_deleted_page() {
     145                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'to-be-deleted-page' ) );
     146                $url = get_permalink( $page_id );
     147
     148                // $url will now point to a deleted page
     149                wp_delete_post( $page_id );
     150
     151                $this->go_to("{$url}feed/");
     152
     153                // make sure the correct wp_query flags are set
     154                $this->assertQueryTrue('is_404', 'is_feed');
     155        }
     156
    141157        function test_page_feed_with_no_comments() {
    142158                $page_ids = array();
    143159                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );