WordPress.org

Make WordPress Core

Ticket #20419: 20419.2.diff

File 20419.2.diff, 1.2 KB (added by boonebgorges, 4 years ago)
  • tests/phpunit/tests/post/wpUniquePostSlug.php

    diff --git tests/phpunit/tests/post/wpUniquePostSlug.php tests/phpunit/tests/post/wpUniquePostSlug.php
    index 354997e..b1b1951 100644
    class Tests_Post_WpUniquePostSlug extends WP_UnitTestCase { 
    302302                $found = wp_unique_post_slug( '32', $p, 'publish', 'post', 0 );
    303303                $this->assertEquals( '32', $found );
    304304        }
     305
     306        /**
     307         * @ticket 20419
     308         * @expectedIncorrectUsage wp_unique_post_slug
     309         */
     310        public function test_post_status_parameter_should_be_expected() {
     311                $conflict = self::factory()->post->create( array(
     312                        'post_name' => 'foo',
     313                        'post_status' => 'publish',
     314                ) );
     315                $found = wp_unique_post_slug( 'foo', 0, 'draft' );
     316                $this->assertSame( 'foo', $found );
     317        }
     318
     319        /**
     320         * @ticket 20419
     321         */
     322        public function test_post_status_parameter_should_be_expected_new_format() {
     323                $conflict = self::factory()->post->create( array(
     324                        'post_name' => 'foo',
     325                        'post_status' => 'publish',
     326                ) );
     327
     328                $post = new stdClass;
     329                $post->post_name = 'foo';
     330                $post->post_status = 'draft';
     331
     332                $found = wp_unique_post_slug( 'foo', $post );
     333                $this->assertSame( 'foo', $found );
     334        }
     335
    305336}