WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/28/2015 07:25:05 PM (4 years ago)
Author:
johnbillion
Message:

Correctly slash post fields when trashing and untrashing posts.

Fixes #27550
Props dmenard, Denis-de-Bernardy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/slashes.php

    r31065 r34668  
    130130    }
    131131
     132    /**
     133     * @ticket 27550
     134     */
     135    function test_wp_trash_untrash() {
     136        $post = array(
     137            'post_title'   => $this->slash_1,
     138            'post_content' => $this->slash_3,
     139            'post_excerpt' => $this->slash_5,
     140        );
     141        $id = wp_insert_post( wp_slash( $post ) );
     142
     143        $trashed = wp_trash_post( $id );
     144        $this->assertNotEmpty( $trashed );
     145
     146        $post = get_post( $id );
     147
     148        $this->assertEquals( $this->slash_1, $post->post_title );
     149        $this->assertEquals( $this->slash_3, $post->post_content );
     150        $this->assertEquals( $this->slash_5, $post->post_excerpt );
     151
     152        $untrashed = wp_untrash_post( $id );
     153        $this->assertNotEmpty( $untrashed );
     154
     155        $post = get_post( $id );
     156
     157        $this->assertEquals( $this->slash_1, $post->post_title );
     158        $this->assertEquals( $this->slash_3, $post->post_content );
     159        $this->assertEquals( $this->slash_5, $post->post_excerpt );
     160    }
    132161}
Note: See TracChangeset for help on using the changeset viewer.