<!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>[850] trunk/wp-testcase/test_query.php: Port test_query.php.</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/850">850</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-02 06:54:55 +0000 (Mon, 02 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Port test_query.php. see <a href="http://unit-tests.trac.wordpress.org/ticket/96">#96</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwptestcasetest_queryphp">trunk/wp-testcase/test_query.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwptestcasetest_queryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test_query.php (849 => 850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_query.php        2012-07-02 06:16:05 UTC (rev 849)
+++ trunk/wp-testcase/test_query.php        2012-07-02 06:54:55 UTC (rev 850)
</span><span class="lines">@@ -5,35 +5,58 @@
</span><span class="cx"> // this exercises both query.php and rewrite.php: urls are fed through the rewrite code,
</span><span class="cx"> // then we test the effects of each url on the wp_query object.
</span><span class="cx"> 
</span><del>-class TestWPQueryVars extends _WPDataset1 {
</del><ins>+class TestWPQueryVars extends WP_UnitTestCase {
+
+        protected $page_ids;
+        protected $post_ids;
+
</ins><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><ins>+
+                update_option( 'comments_per_page', 5 );
+                update_option( 'posts_per_page', 5 );
+
</ins><span class="cx">                 global $wp_rewrite;
</span><del>-                $wp_rewrite-&gt;set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
</del><ins>+                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
</ins><span class="cx">                 create_initial_taxonomies();
</span><del>-                $wp_rewrite-&gt;flush_rules();
</del><ins>+                $GLOBALS['wp_rewrite']-&gt;init();
+                flush_rewrite_rules();
+
+                $this-&gt;post_ids[] = $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;page_ids[] = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
+                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( 15, array( 'post_date' =&gt; '2007-09-04', 'post_content' =&gt; 'This content includes &quot;test&quot;', 'post_author' =&gt; $user_id ) );
+                foreach ( $post_ids as $post_id ) {
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
+                        $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, 'tag-a', 'post_tag' );
+                }
+                $this-&gt;post_ids = array_merge( $this-&gt;post_ids, $post_ids );
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 8, 'post_type' =&gt; 'attachment' ) );
+                $this-&gt;post_ids[] = $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04', 'post_title' =&gt; 'a-post-with-multiple-pages', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
+
+                $this-&gt;post_ids[] = $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $cat_id = $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
+                $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, $cat_id, 'category' );
+
+                $this-&gt;page_ids[] = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'lorem-ipsum' ) );
+                $this-&gt;page_ids[] = $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $this-&gt;page_ids[] = $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $post_id ) );
+                $this-&gt;page_ids[] = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $post_id ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function tearDown() {
</span><del>-                global $wp_rewrite;
-                $wp_rewrite-&gt;set_permalink_structure('');
</del><span class="cx">                 parent::tearDown();
</span><ins>+                $GLOBALS['wp_rewrite']-&gt;init();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function _get_post_id_by_name($name) {
</del><ins>+        function _all_post_ids( $type='post' ) {
</ins><span class="cx">                 global $wpdb;
</span><del>-                $name = $wpdb-&gt;escape($name);
-                $page_id = $wpdb-&gt;get_var(&quot;SELECT ID from {$wpdb-&gt;posts} WHERE post_name = '{$name}' LIMIT 1&quot;);
-                assert(is_numeric($page_id));
-                return $page_id;
</del><ins>+                return $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_type = %s and post_status='publish'&quot;, $type ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function _all_post_ids($type='post') {
-                global $wpdb;
-                $type = $wpdb-&gt;escape($type);
-                return $wpdb-&gt;get_col(&quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_type='{$type}' and post_status='publish'&quot;);
-        }
-
</del><span class="cx">         /**
</span><span class="cx">          * Check each of the WP_Query is_* functions/properties against expected boolean value.
</span><span class="cx">          *
</span><span class="lines">@@ -79,59 +102,57 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_home() {
</span><del>-                $this-&gt;http('/');
</del><ins>+                $this-&gt;go_to('/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_home');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_404() {
</span><del>-                $this-&gt;http('/'.rand_str());
</del><ins>+                $this-&gt;go_to('/'.rand_str());
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_404');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_permalink() {
</span><del>-                $this-&gt;http( get_permalink($this-&gt;_get_post_id_by_name('hello-world')) );
</del><ins>+                $this-&gt;go_to( get_permalink( get_page_by_path( 'hello-world', OBJECT, 'post' ) ) );
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_single', 'is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_post_comments_feed() {
</span><del>-                $this-&gt;http(get_post_comments_feed_link($this-&gt;_get_post_id_by_name('hello-world')));
</del><ins>+                $this-&gt;go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )-&gt;ID ) );
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_page() {
</span><del>-                $page_id = $this-&gt;_get_post_id_by_name('about');
-                $this-&gt;http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'about' );
+                $this-&gt;go_to(get_permalink($page_id));
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_page','is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_parent_page() {
</span><del>-                $page_id = $this-&gt;_get_post_id_by_name('parent-page');
-                $this-&gt;http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page' );
+                $this-&gt;go_to(get_permalink($page_id));
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_page','is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_child_page_1() {
</span><del>-                $page_id = $this-&gt;_get_post_id_by_name('child-page-1');
-                $this-&gt;http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page/child-page-1' );
+                $this-&gt;go_to(get_permalink($page_id));
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_page','is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_child_page_2() {
</span><del>-                $page_id = $this-&gt;_get_post_id_by_name('child-page-2');
-                $this-&gt;http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page/child-page-1/child-page-2' );
+                $this-&gt;go_to(get_permalink($page_id));
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_page','is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '(about)/trackback/?$' =&gt; 'index.php?pagename=$matches[1]&amp;tb=1'
</span><span class="cx">         function test_page_trackback() {
</span><del>-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this-&gt;_get_post_id_by_name($name);
</del><ins>+                foreach ($this-&gt;page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this-&gt;http(&quot;{$url}trackback/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;{$url}trackback/&quot;);
</ins><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this-&gt;assertQueryTrue('is_page','is_singular','is_trackback');
</span><span class="lines">@@ -144,11 +165,9 @@
</span><span class="cx"> 
</span><span class="cx">         //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
</span><span class="cx">         function test_page_feed() {
</span><del>-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this-&gt;_get_post_id_by_name($name);
</del><ins>+                foreach ($this-&gt;page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this-&gt;http(&quot;{$url}feed/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
</ins><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
</span><span class="lines">@@ -162,11 +181,9 @@
</span><span class="cx"> 
</span><span class="cx">         // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
</span><span class="cx">         function test_page_feed_atom() {
</span><del>-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this-&gt;_get_post_id_by_name($name);
</del><ins>+                foreach ($this-&gt;page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this-&gt;http(&quot;{$url}feed/atom/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
</ins><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
</span><span class="lines">@@ -179,11 +196,9 @@
</span><span class="cx"> 
</span><span class="cx">         // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
</span><span class="cx">         function test_page_page_2() {
</span><del>-                $pages = array('about', 'lorem-ipsum', 'parent-page', 'child-page-1', 'child-page-2');
-                foreach ($pages as $name) {
-                        $page_id = $this-&gt;_get_post_id_by_name($name);
</del><ins>+                foreach ($this-&gt;page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this-&gt;http(&quot;{$url}page/2/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;{$url}page/2/&quot;);
</ins><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
</span><span class="lines">@@ -199,7 +214,7 @@
</span><span class="cx">         function test_page_page_2_short() {
</span><span class="cx">                 //return $this-&gt;markTestSkipped();
</span><span class="cx">                 // identical to /about/page/2/ ?
</span><del>-                $this-&gt;http('/about/2/');
</del><ins>+                $this-&gt;go_to('/about/2/');
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_page', 'is_singular');
</span><span class="cx">         }
</span><span class="lines">@@ -217,13 +232,13 @@
</span><span class="cx"> 
</span><span class="cx">                 // long version
</span><span class="cx">                 foreach ($feeds as $feed) {
</span><del>-                        $this-&gt;http(&quot;/feed/{$feed}/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;/feed/{$feed}/&quot;);
</ins><span class="cx">                         $this-&gt;assertQueryTrue('is_feed');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // short version
</span><span class="cx">                 foreach ($feeds as $feed) {
</span><del>-                        $this-&gt;http(&quot;/{$feed}/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;/{$feed}/&quot;);
</ins><span class="cx">                         $this-&gt;assertQueryTrue('is_feed');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -232,7 +247,7 @@
</span><span class="cx">         function test_main_feed() {
</span><span class="cx">                 $types = array('rss2', 'rss', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                        $this-&gt;http(get_feed_link($type));
</del><ins>+                        $this-&gt;go_to(get_feed_link($type));
</ins><span class="cx">                         $this-&gt;assertQueryTrue('is_feed');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -240,7 +255,7 @@
</span><span class="cx">         // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
</span><span class="cx">         function test_paged() {
</span><span class="cx">                 for ($i=2; $i&lt;4; $i++) {
</span><del>-                        $this-&gt;http(&quot;/page/{$i}/&quot;);
</del><ins>+                        $this-&gt;go_to(&quot;/page/{$i}/&quot;);
</ins><span class="cx">                         $this-&gt;assertQueryTrue('is_home', 'is_paged');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -249,20 +264,20 @@
</span><span class="cx">         // 'comments/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
</span><span class="cx">         function test_main_comments_feed() {
</span><span class="cx">                 // check the url as generated by get_post_comments_feed_link()
</span><del>-                $this-&gt;http(get_post_comments_feed_link($this-&gt;_get_post_id_by_name('hello-world')));
</del><ins>+                $this-&gt;go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )-&gt;ID ) );
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
</span><span class="cx"> 
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/comments/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/comments/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/comments/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/comments/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -270,7 +285,7 @@
</span><span class="cx"> 
</span><span class="cx">         // 'comments/page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
</span><span class="cx">         function test_comments_page() {
</span><del>-                $this-&gt;http('/comments/page/2/');
</del><ins>+                $this-&gt;go_to('/comments/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_home', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -281,33 +296,33 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/search/test/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/search/test/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_feed', 'is_search');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/search/test/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/search/test/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_feed', 'is_search');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'search/(.+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?s=$matches[1]&amp;paged=$matches[2]',
</span><span class="cx">         function test_search_paged() {
</span><del>-                $this-&gt;http('/search/test/page/2/');
</del><ins>+                $this-&gt;go_to('/search/test/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_search', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'search/(.+)/?$' =&gt; 'index.php?s=$matches[1]',
</span><span class="cx">         function test_search() {
</span><del>-                $this-&gt;http('/search/test/');
</del><ins>+                $this-&gt;go_to('/search/test/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_search');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_search_encoded_chars() {
</span><span class="cx">                 $this-&gt;knownWPBug(13961);
</span><del>-                $this-&gt;http('/search/F%C3%BCnf%2Bbar/');
</del><ins>+                $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
</ins><span class="cx">                 $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -317,27 +332,27 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/category/cat-a/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/category/cat-a/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/category/cat-a/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/category/cat-a/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'category/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?category_name=$matches[1]&amp;paged=$matches[2]',
</span><span class="cx">         function test_category_paged() {
</span><del>-                $this-&gt;http('/category/uncategorized/page/2/');
</del><ins>+                $this-&gt;go_to('/category/uncategorized/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_category', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'category/(.+?)/?$' =&gt; 'index.php?category_name=$matches[1]',
</span><span class="cx">         function test_category() {
</span><del>-                $this-&gt;http('/category/cat-a/');
</del><ins>+                $this-&gt;go_to('/category/cat-a/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_category');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -347,14 +362,14 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/tag/tag-a/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/tag/tag-a/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/tag/tag-a/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/tag/tag-a/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -362,13 +377,13 @@
</span><span class="cx">         // 'tag/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?tag=$matches[1]&amp;paged=$matches[2]',
</span><span class="cx">         function test_tag_paged() {
</span><span class="cx">                 $this-&gt;markTestSkipped(); // tag-a doesn't have enough posts -&gt; 404
</span><del>-                $this-&gt;http('/tag/tag-a/page/2/');
</del><ins>+                $this-&gt;go_to('/tag/tag-a/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_tag', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'tag/(.+?)/?$' =&gt; 'index.php?tag=$matches[1]',
</span><span class="cx">         function test_tag() {
</span><del>-                $this-&gt;http('/tag/tag-a/');
</del><ins>+                $this-&gt;go_to('/tag/tag-a/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_tag');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -378,27 +393,27 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/author/user-a/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/author/user-a/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/author/user-a/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/author/user-a/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'author/([^/]+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?author_name=$matches[1]&amp;paged=$matches[2]',
</span><span class="cx">         function test_author_paged() {
</span><del>-                $this-&gt;http('/author/user-a/page/2/');
</del><ins>+                $this-&gt;go_to('/author/user-a/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_author', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
</span><span class="cx">         function test_author() {
</span><del>-                $this-&gt;http('/author/user-a/');
</del><ins>+                $this-&gt;go_to('/author/user-a/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_author');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -408,27 +423,27 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/09/04/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/09/04/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/09/04/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/09/04/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;paged=$matches[4]',
</span><span class="cx">         function test_ymd_paged() {
</span><del>-                $this-&gt;http('/2007/09/04/page/2/');
</del><ins>+                $this-&gt;go_to('/2007/09/04/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]',
</span><span class="cx">         function test_ymd() {
</span><del>-                $this-&gt;http('/2007/09/04/');
</del><ins>+                $this-&gt;go_to('/2007/09/04/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -438,27 +453,27 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/09/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/09/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/09/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/09/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;paged=$matches[3]',
</span><span class="cx">         function test_ym_paged() {
</span><del>-                $this-&gt;http('/2007/09/page/2/');
</del><ins>+                $this-&gt;go_to('/2007/09/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]',
</span><span class="cx">         function test_ym() {
</span><del>-                $this-&gt;http('/2007/09/');
</del><ins>+                $this-&gt;go_to('/2007/09/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -468,36 +483,36 @@
</span><span class="cx">                 // check the long form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/feed/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/feed/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 // check the short form
</span><span class="cx">                 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><del>-                                $this-&gt;http(&quot;/2007/{$type}&quot;);
</del><ins>+                                $this-&gt;go_to(&quot;/2007/{$type}&quot;);
</ins><span class="cx">                                 $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;paged=$matches[2]',
</span><span class="cx">         function test_y_paged() {
</span><del>-                $this-&gt;http('/2007/page/2/');
</del><ins>+                $this-&gt;go_to('/2007/page/2/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/?$' =&gt; 'index.php?year=$matches[1]',
</span><span class="cx">         function test_y() {
</span><del>-                $this-&gt;http('/2007/');
</del><ins>+                $this-&gt;go_to('/2007/');
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;tb=1',
</span><span class="cx">         function test_post_trackback() {
</span><del>-                foreach ($this-&gt;_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
-                        $this-&gt;http(&quot;{$permalink}trackback/&quot;);
</del><ins>+                foreach ( $this-&gt;post_ids as $post_id ) {
+                        $permalink = get_permalink( $post_id );
+                        $this-&gt;go_to(&quot;{$permalink}trackback/&quot;);
</ins><span class="cx">                         $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_trackback');
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -505,19 +520,19 @@
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
</span><span class="cx">         function test_post_comment_feed() {
</span><del>-                foreach ($this-&gt;_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
</del><ins>+                foreach ( $this-&gt;post_ids as $post_id ) {
+                        $permalink = get_permalink( $post_id );
</ins><span class="cx"> 
</span><span class="cx">                         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                         foreach ($types as $type) {
</span><del>-                                        $this-&gt;http(&quot;{$permalink}feed/{$type}&quot;);
</del><ins>+                                        $this-&gt;go_to(&quot;{$permalink}feed/{$type}&quot;);
</ins><span class="cx">                                         $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         // check the short form
</span><span class="cx">                         $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx">                         foreach ($types as $type) {
</span><del>-                                        $this-&gt;http(&quot;{$permalink}{$type}&quot;);
</del><ins>+                                        $this-&gt;go_to(&quot;{$permalink}{$type}&quot;);
</ins><span class="cx">                                         $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="lines">@@ -528,7 +543,7 @@
</span><span class="cx">         function test_post_paged_long() {
</span><span class="cx">                 $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts
</span><span class="cx">                 // the long version
</span><del>-                $this-&gt;http('/2007/09/04/a-post-with-multiple-pages/page/2/');
</del><ins>+                $this-&gt;go_to('/2007/09/04/a-post-with-multiple-pages/page/2/');
</ins><span class="cx">                 // should is_paged be true also?
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_single', 'is_singular');
</span><span class="cx">         }
</span><span class="lines">@@ -537,7 +552,7 @@
</span><span class="cx">         function test_post_paged_short() {
</span><span class="cx">                 $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1
</span><span class="cx">                 // and the short version
</span><del>-                $this-&gt;http('/2007/09/04/a-post-with-multiple-pages/2/');
</del><ins>+                $this-&gt;go_to('/2007/09/04/a-post-with-multiple-pages/2/');
</ins><span class="cx">                 // should is_paged be true also?
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_single', 'is_singular');
</span><span class="cx"> 
</span><span class="lines">@@ -547,7 +562,7 @@
</span><span class="cx">         function test_post_attachment() {
</span><span class="cx">                 $this-&gt;markTestSkipped(); // @todo ID 8 is a page in Data Set 1
</span><span class="cx">                 $permalink = get_attachment_link(8);
</span><del>-                $this-&gt;http($permalink);
</del><ins>+                $this-&gt;go_to($permalink);
</ins><span class="cx">                 $this-&gt;assertQueryTrue('is_attachment', 'is_singular');
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -564,8 +579,9 @@
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">                 global $wp_rewrite;
</span><del>-                $wp_rewrite-&gt;set_permalink_structure('/%author%/%year%/%postname%/');
</del><ins>+                update_option( 'permalink_structure', '/%author%/%year%/%postname%/' );
</ins><span class="cx">                 create_initial_taxonomies();
</span><del>-                $wp_rewrite-&gt;flush_rules();
</del><ins>+                $GLOBALS['wp_rewrite']-&gt;init();
+                flush_rewrite_rules();
</ins><span class="cx">         }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>