<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[38283] trunk/tests/phpunit: Add wordpress-importer tests demonstrating slashed data behavior.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/38283">38283</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/38283","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-08-19 13:26:04 +0000 (Fri, 19 Aug 2016)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Add wordpress-importer tests demonstrating slashed data behavior.

See <a href="https://core.trac.wordpress.org/ticket/21007">#21007</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsimportimportphp">trunk/tests/phpunit/tests/import/import.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunitdataexportslashesxml">trunk/tests/phpunit/data/export/slashes.xml</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitdataexportslashesxml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/export/slashes.xml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/export/slashes.xml                               (rev 0)
+++ trunk/tests/phpunit/data/export/slashes.xml 2016-08-19 13:26:04 UTC (rev 38283)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,77 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your site. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
+<!--    contained in this file into your site. -->
+
+<!-- generator="WordPress/3.1-RC2-17315" created="2011-01-18 08:06" -->
+<rss version="2.0"
+       xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+       xmlns:content="http://purl.org/rss/1.0/modules/content/"
+       xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+       xmlns:dc="http://purl.org/dc/elements/1.1/"
+       xmlns:wp="http://wordpress.org/export/1.1/"
+>
+
+<channel>
+       <title>trunk</title>
+       <link>http://localhost/</link>
+       <description>trunk</description>
+       <pubDate>Tue, 18 Jan 2011 08:06:21 +0000</pubDate>
+       <language>en</language>
+       <wp:wxr_version>1.1</wp:wxr_version>
+       <wp:base_site_url>http://localhost/</wp:base_site_url>
+       <wp:base_blog_url>http://localhost/</wp:base_blog_url>
+
+       <wp:author><wp:author_id>1</wp:author_id><wp:author_login>admin</wp:author_login><wp:author_email>local@host.null</wp:author_email><wp:author_display_name><![CDATA[admin]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author>
+
+       <wp:category><wp:term_id>8</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[a \"great\" category]]></wp:cat_name></wp:category>
+       <wp:tag><wp:term_id>33</wp:term_id><wp:tag_slug>tag1</wp:tag_slug><wp:tag_name><![CDATA[foo\'bar]]></wp:tag_name></wp:tag>
+
+       <generator>http://wordpress.org/?v=3.1-RC2-17315</generator>
+
+       <item>
+               <title>Hello world!</title>
+               <link>http://localhost/?p=1</link>
+               <pubDate>Tue, 18 Jan 2011 07:40:14 +0000</pubDate>
+               <dc:creator>author</dc:creator>
+               <guid isPermaLink="false">http://localhost/?p=1</guid>
+               <description></description>
+               <content:encoded><![CDATA[Slashes aren\'t \"cool\"]]></content:encoded>
+               <excerpt:encoded><![CDATA[]]></excerpt:encoded>
+               <wp:post_id>1</wp:post_id>
+               <wp:post_date>2011-01-18 07:40:14</wp:post_date>
+               <wp:post_date_gmt>2011-01-18 07:40:14</wp:post_date_gmt>
+               <wp:comment_status>open</wp:comment_status>
+               <wp:ping_status>open</wp:ping_status>
+               <wp:post_name>hello-world</wp:post_name>
+               <wp:status>publish</wp:status>
+               <wp:post_parent>0</wp:post_parent>
+               <wp:menu_order>0</wp:menu_order>
+               <wp:post_type>post</wp:post_type>
+               <wp:post_password></wp:post_password>
+               <wp:is_sticky>0</wp:is_sticky>
+               <category domain="category" nicename="alpha"><![CDATA[a \"great\" category]]></category>
+               <wp:postmeta>
+                       <wp:meta_key>Post by</wp:meta_key>
+                       <wp:meta_value><![CDATA[admin]]></wp:meta_value>
+               </wp:postmeta>
+               <wp:postmeta>
+                       <wp:meta_key>_edit_last</wp:meta_key>
+                       <wp:meta_value><![CDATA[1]]></wp:meta_value>
+               </wp:postmeta>
+       </item>
+</channel>
+</rss>
</ins></span></pre></div>
<a id="trunktestsphpunittestsimportimportphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/import/import.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/import/import.php       2016-08-19 04:09:55 UTC (rev 38282)
+++ trunk/tests/phpunit/tests/import/import.php 2016-08-19 13:26:04 UTC (rev 38283)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,5 +249,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_importers = $_wp_importers; // Restore global state
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * @ticket 21007
+        */
+       public function test_slashes_should_not_be_stripped() {
+               global $wpdb;
+
+               $authors = array( 'admin' => false );
+               $this->_import_wp( DIR_TESTDATA . '/export/slashes.xml', $authors );
+
+               $alpha = get_term_by( 'slug', 'alpha', 'category' );
+               $this->assertSame( 'a \"great\" category', $alpha->name );
+
+               $tag1 = get_term_by( 'slug', 'tag1', 'post_tag' );
+               $this->assertSame( "foo\'bar", $tag1->name );
+
+               $posts = get_posts( array( 'post_type' => 'any', 'post_status' => 'any' ) );
+               $this->assertSame( 'Slashes aren\\\'t \"cool\"', $posts[0]->post_content );
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         // function test_menu_import
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>

</body>
</html>