WordPress.org

Make WordPress Core

Ticket #37423: 37423.test.diff

File 37423.test.diff, 1.0 KB (added by enshrined, 5 years ago)

Test for 47423.diff

  • tests/phpunit/tests/admin/includesPost.php

     
    365365        }
    366366
    367367        /**
     368         * @ticket 30910
     369         * @ticket 18306
     370         */
     371        public function test_get_sample_permalink_html_should_use_preview_links_for_draft_and_pending_posts_with_no_post_name() {
     372                $this->set_permalink_structure( '/%postname%/' );
     373
     374                wp_set_current_user( self::$admin_id );
     375
     376                $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     377                $p = self::factory()->post->create( array( 'post_status' => 'pending', 'post_name' => '', 'post_date' => $future_date ) );
     378
     379                $found = get_sample_permalink_html( $p );
     380                $post = get_post( $p );
     381                $this->assertContains( 'href="' . esc_url( get_preview_post_link( $post ) ), $found );
     382        }
     383
     384        /**
    368385         * @ticket 5305
    369386         */
    370387        public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_year_archives() {