Make WordPress Core

Ticket #27550: 27550-phpunit-test.diff

File 27550-phpunit-test.diff, 1.0 KB (added by dmenard, 10 years ago)

PhpUnit test showing the bug

  • tests/phpunit/tests/post/slashes.php

     
    129129                $this->assertEquals( wp_unslash( $this->slash_6 ), $post->post_excerpt );
    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                wp_trash_post($id);
     144                $post = get_post($id);
     145                $this->assertEquals($this->slash_1, $post->post_title);
     146                $this->assertEquals($this->slash_3, $post->post_content);
     147                $this->assertEquals($this->slash_5, $post->post_excerpt);
     148
     149                wp_untrash_post($id);
     150                $post = get_post($id);
     151                $this->assertEquals($this->slash_1, $post->post_title);
     152                $this->assertEquals($this->slash_3, $post->post_content);
     153                $this->assertEquals($this->slash_5, $post->post_excerpt);
     154        }
    132155}