WordPress.org

Make WordPress Core

Changeset 38283


Ignore:
Timestamp:
08/19/2016 01:26:04 PM (5 years ago)
Author:
boonebgorges
Message:

Add wordpress-importer tests demonstrating slashed data behavior.

See #21007.

Location:
trunk/tests/phpunit
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/import/import.php

    r33250 r38283  
    250250    }
    251251
     252    /**
     253     * @ticket 21007
     254     */
     255    public function test_slashes_should_not_be_stripped() {
     256        global $wpdb;
     257
     258        $authors = array( 'admin' => false );
     259        $this->_import_wp( DIR_TESTDATA . '/export/slashes.xml', $authors );
     260
     261        $alpha = get_term_by( 'slug', 'alpha', 'category' );
     262        $this->assertSame( 'a \"great\" category', $alpha->name );
     263
     264        $tag1 = get_term_by( 'slug', 'tag1', 'post_tag' );
     265        $this->assertSame( "foo\'bar", $tag1->name );
     266
     267        $posts = get_posts( array( 'post_type' => 'any', 'post_status' => 'any' ) );
     268        $this->assertSame( 'Slashes aren\\\'t \"cool\"', $posts[0]->post_content );
     269    }
     270
    252271    // function test_menu_import
    253272}
Note: See TracChangeset for help on using the changeset viewer.