WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/tests/phpunit/tests/rewrite/oldSlugRedirect.php

    r35242 r36129  
    151151    }
    152152
     153    /**
     154     * @ticket 35031
     155     */
     156    public function test_old_slug_doesnt_redirect_when_reused() {
     157        $old_permalink = user_trailingslashit( get_permalink( $this->post_id ) );
     158
     159        wp_update_post( array(
     160            'ID' => $this->post_id,
     161            'post_name' => 'bar-baz',
     162        ) );
     163
     164        $new_post_id = self::factory()->post->create( array(
     165            'post_title'   => 'Foo Bar',
     166            'post_name'   => 'foo-bar',
     167        ) );
     168
     169        $permalink = user_trailingslashit( get_permalink( $new_post_id ) );
     170
     171        $this->assertEquals( $old_permalink, $permalink );
     172
     173        $this->go_to( $old_permalink );
     174        wp_old_slug_redirect();
     175        $this->assertNull( $this->old_slug_redirect_url );
     176    }
     177
    153178    public function filter_old_slug_redirect_url( $url ) {
    154179        $this->old_slug_redirect_url = $url;
Note: See TracChangeset for help on using the changeset viewer.