<!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->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->flush_rules();
</del><ins>+                $GLOBALS['wp_rewrite']->init();
+                flush_rewrite_rules();
+
+                $this->post_ids[] = $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+                $this->factory->comment->create_post_comments( $post_id, 2 );
+
+                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+                $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+                $post_ids = $this->factory->post->create_many( 15, array( 'post_date' => '2007-09-04', 'post_content' => 'This content includes "test"', 'post_author' => $user_id ) );
+                foreach ( $post_ids as $post_id ) {
+                        $this->factory->comment->create_post_comments( $post_id, 2 );
+                        $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
+                }
+                $this->post_ids = array_merge( $this->post_ids, $post_ids );
+
+                $this->factory->post->create( array( 'import_id' => 8, 'post_type' => 'attachment' ) );
+                $this->post_ids[] = $this->factory->post->create( array( 'post_date' => '2007-09-04', 'post_title' => 'a-post-with-multiple-pages', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+
+                $this->post_ids[] = $post_id = $this->factory->post->create();
+                $cat_id = $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
+                $this->factory->term->add_post_terms( $post_id, $cat_id, 'category' );
+
+                $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'lorem-ipsum' ) );
+                $this->page_ids[] = $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $this->page_ids[] = $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id ) );
+                $this->page_ids[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $post_id ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function tearDown() {
</span><del>-                global $wp_rewrite;
-                $wp_rewrite->set_permalink_structure('');
</del><span class="cx">                 parent::tearDown();
</span><ins>+                $GLOBALS['wp_rewrite']->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->escape($name);
-                $page_id = $wpdb->get_var("SELECT ID from {$wpdb->posts} WHERE post_name = '{$name}' LIMIT 1");
-                assert(is_numeric($page_id));
-                return $page_id;
</del><ins>+                return $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s and post_status='publish'", $type ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function _all_post_ids($type='post') {
-                global $wpdb;
-                $type = $wpdb->escape($type);
-                return $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type='{$type}' and post_status='publish'");
-        }
-
</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->http('/');
</del><ins>+                $this->go_to('/');
</ins><span class="cx">                 $this->assertQueryTrue('is_home');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_404() {
</span><del>-                $this->http('/'.rand_str());
</del><ins>+                $this->go_to('/'.rand_str());
</ins><span class="cx">                 $this->assertQueryTrue('is_404');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_permalink() {
</span><del>-                $this->http( get_permalink($this->_get_post_id_by_name('hello-world')) );
</del><ins>+                $this->go_to( get_permalink( get_page_by_path( 'hello-world', OBJECT, 'post' ) ) );
</ins><span class="cx">                 $this->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->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
</del><ins>+                $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) );
</ins><span class="cx">                 $this->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->_get_post_id_by_name('about');
-                $this->http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'about' );
+                $this->go_to(get_permalink($page_id));
</ins><span class="cx">                 $this->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->_get_post_id_by_name('parent-page');
-                $this->http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page' );
+                $this->go_to(get_permalink($page_id));
</ins><span class="cx">
</span><span class="cx">                 $this->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->_get_post_id_by_name('child-page-1');
-                $this->http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page/child-page-1' );
+                $this->go_to(get_permalink($page_id));
</ins><span class="cx">
</span><span class="cx">                 $this->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->_get_post_id_by_name('child-page-2');
-                $this->http(get_permalink($page_id));
</del><ins>+                $page_id = get_page_by_path( 'parent-page/child-page-1/child-page-2' );
+                $this->go_to(get_permalink($page_id));
</ins><span class="cx">
</span><span class="cx">                 $this->assertQueryTrue('is_page','is_singular');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&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->_get_post_id_by_name($name);
</del><ins>+                foreach ($this->page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this->http("{$url}trackback/");
</del><ins>+                        $this->go_to("{$url}trackback/");
</ins><span class="cx">
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this->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)/?$' => 'index.php?pagename=$matches[1]&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->_get_post_id_by_name($name);
</del><ins>+                foreach ($this->page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this->http("{$url}feed/");
</del><ins>+                        $this->go_to("{$url}feed/");
</ins><span class="cx">
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this->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)/?$' => 'index.php?pagename=$matches[1]&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->_get_post_id_by_name($name);
</del><ins>+                foreach ($this->page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this->http("{$url}feed/atom/");
</del><ins>+                        $this->go_to("{$url}feed/atom/");
</ins><span class="cx">
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this->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,})/?$' => 'index.php?pagename=$matches[1]&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->_get_post_id_by_name($name);
</del><ins>+                foreach ($this->page_ids as $page_id) {
</ins><span class="cx">                         $url = get_permalink($page_id);
</span><del>-                        $this->http("{$url}page/2/");
</del><ins>+                        $this->go_to("{$url}page/2/");
</ins><span class="cx">
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="cx">                         $this->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->markTestSkipped();
</span><span class="cx">                 // identical to /about/page/2/ ?
</span><del>-                $this->http('/about/2/');
</del><ins>+                $this->go_to('/about/2/');
</ins><span class="cx">
</span><span class="cx">                 $this->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->http("/feed/{$feed}/");
</del><ins>+                        $this->go_to("/feed/{$feed}/");
</ins><span class="cx">                         $this->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->http("/{$feed}/");
</del><ins>+                        $this->go_to("/{$feed}/");
</ins><span class="cx">                         $this->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->http(get_feed_link($type));
</del><ins>+                        $this->go_to(get_feed_link($type));
</ins><span class="cx">                         $this->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,})/?$' => 'index.php?&paged=$matches[1]',
</span><span class="cx">         function test_paged() {
</span><span class="cx">                 for ($i=2; $i<4; $i++) {
</span><del>-                        $this->http("/page/{$i}/");
</del><ins>+                        $this->go_to("/page/{$i}/");
</ins><span class="cx">                         $this->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)/?$' => 'index.php?&feed=$matches[1]&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->http(get_post_comments_feed_link($this->_get_post_id_by_name('hello-world')));
</del><ins>+                $this->go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )->ID ) );
</ins><span class="cx">                 $this->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->http("/comments/feed/{$type}");
</del><ins>+                                $this->go_to("/comments/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/comments/{$type}");
</del><ins>+                                $this->go_to("/comments/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?&paged=$matches[1]',
</span><span class="cx">         function test_comments_page() {
</span><del>-                $this->http('/comments/page/2/');
</del><ins>+                $this->go_to('/comments/page/2/');
</ins><span class="cx">                 $this->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->http("/search/test/feed/{$type}");
</del><ins>+                                $this->go_to("/search/test/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/search/test/{$type}");
</del><ins>+                                $this->go_to("/search/test/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
</span><span class="cx">         function test_search_paged() {
</span><del>-                $this->http('/search/test/page/2/');
</del><ins>+                $this->go_to('/search/test/page/2/');
</ins><span class="cx">                 $this->assertQueryTrue('is_search', 'is_paged');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
</span><span class="cx">         function test_search() {
</span><del>-                $this->http('/search/test/');
</del><ins>+                $this->go_to('/search/test/');
</ins><span class="cx">                 $this->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->knownWPBug(13961);
</span><del>-                $this->http('/search/F%C3%BCnf%2Bbar/');
</del><ins>+                $this->go_to('/search/F%C3%BCnf%2Bbar/');
</ins><span class="cx">                 $this->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->http("/category/cat-a/feed/{$type}");
</del><ins>+                                $this->go_to("/category/cat-a/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/category/cat-a/{$type}");
</del><ins>+                                $this->go_to("/category/cat-a/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
</span><span class="cx">         function test_category_paged() {
</span><del>-                $this->http('/category/uncategorized/page/2/');
</del><ins>+                $this->go_to('/category/uncategorized/page/2/');
</ins><span class="cx">                 $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
</span><span class="cx">         function test_category() {
</span><del>-                $this->http('/category/cat-a/');
</del><ins>+                $this->go_to('/category/cat-a/');
</ins><span class="cx">                 $this->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->http("/tag/tag-a/feed/{$type}");
</del><ins>+                                $this->go_to("/tag/tag-a/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/tag/tag-a/{$type}");
</del><ins>+                                $this->go_to("/tag/tag-a/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
</span><span class="cx">         function test_tag_paged() {
</span><span class="cx">                 $this->markTestSkipped(); // tag-a doesn't have enough posts -> 404
</span><del>-                $this->http('/tag/tag-a/page/2/');
</del><ins>+                $this->go_to('/tag/tag-a/page/2/');
</ins><span class="cx">                 $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
</span><span class="cx">         function test_tag() {
</span><del>-                $this->http('/tag/tag-a/');
</del><ins>+                $this->go_to('/tag/tag-a/');
</ins><span class="cx">                 $this->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->http("/author/user-a/feed/{$type}");
</del><ins>+                                $this->go_to("/author/user-a/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/author/user-a/{$type}");
</del><ins>+                                $this->go_to("/author/user-a/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
</span><span class="cx">         function test_author_paged() {
</span><del>-                $this->http('/author/user-a/page/2/');
</del><ins>+                $this->go_to('/author/user-a/page/2/');
</ins><span class="cx">                 $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
</span><span class="cx">         function test_author() {
</span><del>-                $this->http('/author/user-a/');
</del><ins>+                $this->go_to('/author/user-a/');
</ins><span class="cx">                 $this->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->http("/2007/09/04/feed/{$type}");
</del><ins>+                                $this->go_to("/2007/09/04/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/2007/09/04/{$type}");
</del><ins>+                                $this->go_to("/2007/09/04/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
</span><span class="cx">         function test_ymd_paged() {
</span><del>-                $this->http('/2007/09/04/page/2/');
</del><ins>+                $this->go_to('/2007/09/04/page/2/');
</ins><span class="cx">                 $this->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})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
</span><span class="cx">         function test_ymd() {
</span><del>-                $this->http('/2007/09/04/');
</del><ins>+                $this->go_to('/2007/09/04/');
</ins><span class="cx">                 $this->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->http("/2007/09/feed/{$type}");
</del><ins>+                                $this->go_to("/2007/09/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/2007/09/{$type}");
</del><ins>+                                $this->go_to("/2007/09/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
</span><span class="cx">         function test_ym_paged() {
</span><del>-                $this->http('/2007/09/page/2/');
</del><ins>+                $this->go_to('/2007/09/page/2/');
</ins><span class="cx">                 $this->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})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
</span><span class="cx">         function test_ym() {
</span><del>-                $this->http('/2007/09/');
</del><ins>+                $this->go_to('/2007/09/');
</ins><span class="cx">                 $this->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->http("/2007/feed/{$type}");
</del><ins>+                                $this->go_to("/2007/feed/{$type}");
</ins><span class="cx">                                 $this->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->http("/2007/{$type}");
</del><ins>+                                $this->go_to("/2007/{$type}");
</ins><span class="cx">                                 $this->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,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
</span><span class="cx">         function test_y_paged() {
</span><del>-                $this->http('/2007/page/2/');
</del><ins>+                $this->go_to('/2007/page/2/');
</ins><span class="cx">                 $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
</span><span class="cx">         function test_y() {
</span><del>-                $this->http('/2007/');
</del><ins>+                $this->go_to('/2007/');
</ins><span class="cx">                 $this->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/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
</span><span class="cx">         function test_post_trackback() {
</span><del>-                foreach ($this->_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
-                        $this->http("{$permalink}trackback/");
</del><ins>+                foreach ( $this->post_ids as $post_id ) {
+                        $permalink = get_permalink( $post_id );
+                        $this->go_to("{$permalink}trackback/");
</ins><span class="cx">                         $this->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)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
</span><span class="cx">         function test_post_comment_feed() {
</span><del>-                foreach ($this->_all_post_ids() as $id) {
-                        $permalink = get_permalink($id);
</del><ins>+                foreach ( $this->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->http("{$permalink}feed/{$type}");
</del><ins>+                                        $this->go_to("{$permalink}feed/{$type}");
</ins><span class="cx">                                         $this->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->http("{$permalink}{$type}");
</del><ins>+                                        $this->go_to("{$permalink}{$type}");
</ins><span class="cx">                                         $this->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->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->http('/2007/09/04/a-post-with-multiple-pages/page/2/');
</del><ins>+                $this->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->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->markTestSkipped(); // @todo post doesn't exist in Data Set 1
</span><span class="cx">                 // and the short version
</span><del>-                $this->http('/2007/09/04/a-post-with-multiple-pages/2/');
</del><ins>+                $this->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->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->markTestSkipped(); // @todo ID 8 is a page in Data Set 1
</span><span class="cx">                 $permalink = get_attachment_link(8);
</span><del>-                $this->http($permalink);
</del><ins>+                $this->go_to($permalink);
</ins><span class="cx">                 $this->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->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->flush_rules();
</del><ins>+                $GLOBALS['wp_rewrite']->init();
+                flush_rewrite_rules();
</ins><span class="cx">         }
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>