<!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>[Tests][1041] trunk/tests: adding initial slashes test cases for core ticket #21676</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, #logmsg > ol { margin-left: 0; 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">
<dt>Revision</dt> <dd><a href="http://unit-tests.trac.wordpress.org/changeset/1041">1041</a></dd>
<dt>Author</dt> <dd>alexkingorg</dd>
<dt>Date</dt> <dd>2012-09-22 22:04:30 +0000 (Sat, 22 Sep 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>adding initial slashes test cases for core ticket <a href="http://unit-tests.trac.wordpress.org/ticket/21676">#21676</a></pre>
<h3>Added Paths</h3>
<ul>
<li>trunk/tests/comment/</li>
<li><a href="#trunktestscommentslashesphp">trunk/tests/comment/slashes.php</a></li>
<li>trunk/tests/meta/</li>
<li><a href="#trunktestsmetaslashesphp">trunk/tests/meta/slashes.php</a></li>
<li><a href="#trunktestspostslashesphp">trunk/tests/post/slashes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestscommentslashesphp"></a>
<div class="addfile"><h4>Added: trunk/tests/comment/slashes.php (0 => 1041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/comment/slashes.php         (rev 0)
+++ trunk/tests/comment/slashes.php        2012-09-22 22:04:30 UTC (rev 1041)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+<?php
+
+/**
+ * @group comment
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Comment_Slashes extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                // we need an admin user to bypass comment flood protection
+                $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->author_id );
+                
+                // it is important to test with both even and odd numbered slashes as
+                // kses does a strip-then-add slashes in some of it's function calls
+                $this->slash_1 = 'String with 1 slash \\';
+                $this->slash_2 = 'String with 2 slashes \\\\';
+                $this->slash_3 = 'String with 3 slashes \\\\\\';
+                $this->slash_4 = 'String with 4 slashes \\\\\\\\';
+                $this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+                $this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+                $this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this->old_current_user );
+                parent::tearDown();
+        }
+
+        /**
+         * Tests the extended model function that expects un-slashed data
+         *
+         */
+        function test_wp_new_comment() {
+                $post_id = $this->factory->post->create();
+
+                // not testing comment_author_email or comment_author_url
+                // as slashes are not permitted in that data
+                $data = array(
+                        'comment_post_ID' => $post_id,
+                        'comment_author' => $this->slash_1,
+                        'comment_content' => $this->slash_7,
+                );
+                $id = wp_new_comment( $data );
+
+                $comment = get_comment($id);
+
+                $this->assertEquals( $this->slash_1, $comment->comment_author );
+                $this->assertEquals( $this->slash_7, $comment->comment_content );
+
+                $data = array(
+                        'comment_post_ID' => $post_id,
+                        'comment_author' => $this->slash_2,
+                        'comment_content' => $this->slash_4,
+                );
+                $id = wp_new_comment( $data );
+
+                $comment = get_comment($id);
+
+                $this->assertEquals( $this->slash_2, $comment->comment_author );
+                $this->assertEquals( $this->slash_4, $comment->comment_content );
+        }
+
+        /**
+         * Tests the controller function that expects slashed data
+         *
+         */
+        function test_edit_comment() {
+                $post_id = $this->factory->post->create();
+                $comment_id = $this->factory->comment->create(array(
+                        'comment_post_ID' => $post_id
+                ));
+
+                // not testing comment_author_email or comment_author_url
+                // as slashes are not permitted in that data
+                $_POST = array();
+                $_POST['comment_ID'] = $comment_id;
+                $_POST['newcomment_author'] = $this->slash_1;
+                $_POST['content'] = $this->slash_7;
+                $_POST = add_magic_quotes( $_POST );
+                
+                edit_comment();
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_1, $comment->comment_author );
+                $this->assertEquals( $this->slash_7, $comment->comment_content );
+
+                $_POST = array();
+                $_POST['comment_ID'] = $comment_id;
+                $_POST['newcomment_author'] = $this->slash_2;
+                $_POST['content'] = $this->slash_4;
+                $_POST = add_magic_quotes( $_POST );
+                
+                edit_comment();
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_2, $comment->comment_author );
+                $this->assertEquals( $this->slash_4, $comment->comment_content );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_insert_comment() {
+                $post_id = $this->factory->post->create();
+                
+                $comment_id = wp_insert_comment(array(
+                        'comment_post_ID' => $post_id,
+                        'comment_author' => $this->slash_1,
+                        'comment_content' => $this->slash_7,
+                ));
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_1, $comment->comment_author );
+                $this->assertEquals( $this->slash_7, $comment->comment_content );
+
+                $comment_id = wp_insert_comment(array(
+                        'comment_post_ID' => $post_id,
+                        'comment_author' => $this->slash_2,
+                        'comment_content' => $this->slash_4,
+                ));
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_2, $comment->comment_author );
+                $this->assertEquals( $this->slash_4, $comment->comment_content );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_update_comment() {
+                $post_id = $this->factory->post->create();
+                $comment_id = $this->factory->comment->create(array(
+                        'comment_post_ID' => $post_id
+                ));
+                
+                wp_update_comment(array(
+                        'comment_ID' => $comment_id,
+                        'comment_author' => $this->slash_1,
+                        'comment_content' => $this->slash_7,
+                ));
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_1, $comment->comment_author );
+                $this->assertEquals( $this->slash_7, $comment->comment_content );
+
+                wp_update_comment(array(
+                        'comment_ID' => $comment_id,
+                        'comment_author' => $this->slash_2,
+                        'comment_content' => $this->slash_4,
+                ));
+                $comment = get_comment( $comment_id );
+
+                $this->assertEquals( $this->slash_2, $comment->comment_author );
+                $this->assertEquals( $this->slash_4, $comment->comment_content );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsmetaslashesphp"></a>
<div class="addfile"><h4>Added: trunk/tests/meta/slashes.php (0 => 1041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/meta/slashes.php         (rev 0)
+++ trunk/tests/meta/slashes.php        2012-09-22 22:04:30 UTC (rev 1041)
</span><span class="lines">@@ -0,0 +1,223 @@
</span><ins>+<?php
+
+/**
+ * @group meta
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Meta_Slashes extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->author_id );
+
+                $this->slash_1 = 'String with 1 slash \\';
+                $this->slash_2 = 'String with 2 slashes \\\\';
+                $this->slash_3 = 'String with 3 slashes \\\\\\';
+                $this->slash_4 = 'String with 4 slashes \\\\\\\\';
+                $this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+                $this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+                $this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this->old_current_user );
+                parent::tearDown();
+        }
+
+        /**
+         * Tests the controller function that expects slashed data
+         *
+         */
+        function test_edit_post() {
+                $id = $this->factory->post->create();
+                if ( function_exists( 'wp_add_post_meta' ) ) {
+                        $meta_1 = wp_add_post_meta( $id, 'slash_test_1', 'foo' );
+                        $meta_2 = wp_add_post_meta( $id, 'slash_test_2', 'foo' );
+                        $meta_3 = wp_add_post_meta( $id, 'slash_test_3', 'foo' );
+                }
+                else {
+                        // expects slashed data
+                        $meta_1 = add_post_meta( $id, 'slash_test_1', addslashes( 'foo' ) );
+                        $meta_2 = add_post_meta( $id, 'slash_test_2', addslashes( 'foo' ) );
+                        $meta_3 = add_post_meta( $id, 'slash_test_3', addslashes( 'foo' ) );
+                }
+
+                $_POST = array();
+                $_POST['post_ID'] = $id;
+                $_POST['metakeyselect'] = '#NONE#';
+                $_POST['metakeyinput'] = 'slash_test_0';
+                $_POST['metavalue'] = $this->slash_6;
+                $_POST['meta'] = array(
+                        $meta_1 => array(
+                                'key' => 'slash_test_1',
+                                'value' => $this->slash_1
+                        ),
+                        $meta_2 => array(
+                                'key' => 'slash_test_2',
+                                'value' => $this->slash_3
+                        ),
+                        $meta_3 => array(
+                                'key' => 'slash_test_3',
+                                'value' => $this->slash_4
+                        ),
+                );
+                $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+                edit_post();
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_6, get_post_meta( $id, 'slash_test_0', true ) );
+                $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+
+                $_POST = array();
+                $_POST['post_ID'] = $id;
+                $_POST['metakeyselect'] = '#NONE#';
+                $_POST['metakeyinput'] = 'slash_test_0';
+                $_POST['metavalue'] = $this->slash_7;
+                $_POST['meta'] = array(
+                        $meta_1 => array(
+                                'key' => 'slash_test_1',
+                                'value' => $this->slash_2
+                        ),
+                        $meta_2 => array(
+                                'key' => 'slash_test_2',
+                                'value' => $this->slash_4
+                        ),
+                        $meta_3 => array(
+                                'key' => 'slash_test_3',
+                                'value' => $this->slash_5
+                        ),
+                );
+                $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+                edit_post();
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_2, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_5, get_post_meta( $id, 'slash_test_3', true ) );
+        }
+
+        /**
+         * Tests the legacy model function that expects slashed data
+         *
+         */
+        function test_add_post_meta() {
+                $id = $this->factory->post->create();
+                add_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
+                add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
+                add_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
+
+                $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+        }
+
+        /**
+         * Tests the legacy model function that expects slashed data
+         *
+         */
+        function test_update_post_meta() {
+                $id = $this->factory->post->create();
+                update_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
+                update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
+                update_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
+
+                $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_add_post_meta() {
+                if ( !function_exists( 'wp_add_post_meta' ) ) {
+                        return;
+                }
+                $id = $this->factory->post->create();
+                wp_add_post_meta( $id, 'slash_test_1', $this->slash_1 );
+                wp_add_post_meta( $id, 'slash_test_2', $this->slash_3 );
+                wp_add_post_meta( $id, 'slash_test_3', $this->slash_4 );
+
+                $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_update_post_meta() {
+                if ( !function_exists( 'wp_update_post_meta' ) ) {
+                        return;
+                }
+                $id = $this->factory->post->create();
+                wp_update_post_meta( $id, 'slash_test_1', $this->slash_1 );
+                wp_update_post_meta( $id, 'slash_test_2', $this->slash_3 );
+                wp_update_post_meta( $id, 'slash_test_3', $this->slash_4 );
+
+                $this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_add_comment_meta() {
+                $id = $this->factory->comment->create();
+
+                add_comment_meta( $id, 'slash_test_1', $this->slash_1 );
+                add_comment_meta( $id, 'slash_test_2', $this->slash_3 );
+                add_comment_meta( $id, 'slash_test_3', $this->slash_5 );
+
+                $this->assertEquals( $this->slash_1, get_comment_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_comment_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_5, get_comment_meta( $id, 'slash_test_3', true ) );
+
+                add_comment_meta( $id, 'slash_test_4', $this->slash_2 );
+                add_comment_meta( $id, 'slash_test_5', $this->slash_4 );
+                add_comment_meta( $id, 'slash_test_6', $this->slash_6 );
+
+                $this->assertEquals( $this->slash_2, get_comment_meta( $id, 'slash_test_4', true ) );
+                $this->assertEquals( $this->slash_4, get_comment_meta( $id, 'slash_test_5', true ) );
+                $this->assertEquals( $this->slash_6, get_comment_meta( $id, 'slash_test_6', true ) );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_update_comment_meta() {
+                $id = $this->factory->comment->create();
+
+                add_comment_meta( $id, 'slash_test_1', 'foo' );
+                add_comment_meta( $id, 'slash_test_2', 'foo' );
+                add_comment_meta( $id, 'slash_test_3', 'foo' );
+
+                update_comment_meta( $id, 'slash_test_1', $this->slash_1 );
+                update_comment_meta( $id, 'slash_test_2', $this->slash_3 );
+                update_comment_meta( $id, 'slash_test_3', $this->slash_5 );
+
+                $this->assertEquals( $this->slash_1, get_comment_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_3, get_comment_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_5, get_comment_meta( $id, 'slash_test_3', true ) );
+
+                update_comment_meta( $id, 'slash_test_1', $this->slash_2 );
+                update_comment_meta( $id, 'slash_test_2', $this->slash_4 );
+                update_comment_meta( $id, 'slash_test_3', $this->slash_6 );
+
+                $this->assertEquals( $this->slash_2, get_comment_meta( $id, 'slash_test_1', true ) );
+                $this->assertEquals( $this->slash_4, get_comment_meta( $id, 'slash_test_2', true ) );
+                $this->assertEquals( $this->slash_6, get_comment_meta( $id, 'slash_test_3', true ) );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestspostslashesphp"></a>
<div class="addfile"><h4>Added: trunk/tests/post/slashes.php (0 => 1041)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/slashes.php         (rev 0)
+++ trunk/tests/post/slashes.php        2012-09-22 22:04:30 UTC (rev 1041)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+<?php
+
+/**
+ * @group post
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Post_Slashes extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+                $this->old_current_user = get_current_user_id();
+                wp_set_current_user( $this->author_id );
+                
+                // it is important to test with both even and odd numbered slashes as
+                // kses does a strip-then-add slashes in some of it's function calls
+                $this->slash_1 = 'String with 1 slash \\';
+                $this->slash_2 = 'String with 2 slashes \\\\';
+                $this->slash_3 = 'String with 3 slashes \\\\\\';
+                $this->slash_4 = 'String with 4 slashes \\\\\\\\';
+                $this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+                $this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+                $this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this->old_current_user );
+                parent::tearDown();
+        }
+
+        /**
+         * Tests the controller function that expects slashed data
+         *
+         */
+        function test_edit_post() {
+                $id = $this->factory->post->create();
+
+                $_POST = array();
+                $_POST['post_ID'] = $id;
+                $_POST['post_title'] = $this->slash_1;
+                $_POST['content'] = $this->slash_5;
+                $_POST['excerpt'] = $this->slash_7;
+                $_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+                $post_id = edit_post();
+                $post = get_post( $post_id );
+
+                $this->assertEquals( $this->slash_1, $post->post_title );
+                $this->assertEquals( $this->slash_5, $post->post_content );
+                $this->assertEquals( $this->slash_7, $post->post_excerpt );
+
+                $_POST = array();
+                $_POST['post_ID'] = $id;
+                $_POST['post_title'] = $this->slash_2;
+                $_POST['content'] = $this->slash_4;
+                $_POST['excerpt'] = $this->slash_6;
+                $_POST = add_magic_quotes( $_POST );
+
+                $post_id = edit_post();
+                $post = get_post( $post_id );
+
+                $this->assertEquals( $this->slash_2, $post->post_title );
+                $this->assertEquals( $this->slash_4, $post->post_content );
+                $this->assertEquals( $this->slash_6, $post->post_excerpt );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_insert_post() {
+                $id = wp_insert_post(array(
+                        'post_status' => 'publish',
+                        'post_title' => $this->slash_1,
+                        'post_content' => $this->slash_3,
+                        'post_excerpt' => $this->slash_5,
+                        'post_type' => 'post'
+                ));
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_1, $post->post_title );
+                $this->assertEquals( $this->slash_3, $post->post_content );
+                $this->assertEquals( $this->slash_5, $post->post_excerpt );
+
+                $id = wp_insert_post(array(
+                        'post_status' => 'publish',
+                        'post_title' => $this->slash_2,
+                        'post_content' => $this->slash_4,
+                        'post_excerpt' => $this->slash_6,
+                        'post_type' => 'post'
+                ));
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_2, $post->post_title );
+                $this->assertEquals( $this->slash_4, $post->post_content );
+                $this->assertEquals( $this->slash_6, $post->post_excerpt );
+        }
+
+        /**
+         * Tests the model function that expects un-slashed data
+         *
+         */
+        function test_wp_update_post() {
+                $id = $this->factory->post->create();
+        
+                wp_update_post(array(
+                        'ID' => $id,
+                        'post_title' => $this->slash_1,
+                        'post_content' => $this->slash_3,
+                        'post_excerpt' => $this->slash_5,
+                ));
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_1, $post->post_title );
+                $this->assertEquals( $this->slash_3, $post->post_content );
+                $this->assertEquals( $this->slash_5, $post->post_excerpt );
+
+                wp_update_post(array(
+                        'ID' => $id,
+                        'post_title' => $this->slash_2,
+                        'post_content' => $this->slash_4,
+                        'post_excerpt' => $this->slash_6,
+                ));
+                $post = get_post( $id );
+
+                $this->assertEquals( $this->slash_2, $post->post_title );
+                $this->assertEquals( $this->slash_4, $post->post_content );
+                $this->assertEquals( $this->slash_6, $post->post_excerpt );
+        }
+
+}
</ins></span></pre>
</div>
</div>
</body>
</html>