<!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][863] trunk/wp-testcase/test_query.php: Move all factory work for test_query.php into individual tests.</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/863">863</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-02 17:58:37 +0000 (Mon, 02 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move all factory work for test_query.php into individual tests. No skipped tests, no incomplete tests. see <a href="http://unit-tests.trac.wordpress.org/ticket/96">#96</a>. see #WP21138.</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 (862 => 863)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_query.php        2012-07-02 17:57:04 UTC (rev 862)
+++ trunk/wp-testcase/test_query.php        2012-07-02 17:58:37 UTC (rev 863)
</span><span class="lines">@@ -21,30 +21,6 @@
</span><span class="cx">                 create_initial_taxonomies();
</span><span class="cx">                 $GLOBALS['wp_rewrite']-&gt;init();
</span><span class="cx">                 flush_rewrite_rules();
</span><del>-
-                $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 00:00:00', '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 00:00:00', '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 ) );
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function tearDown() {
</span><span class="lines">@@ -112,46 +88,57 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_permalink() {
</span><del>-                $this-&gt;go_to( get_permalink( get_page_by_path( 'hello-world', OBJECT, 'post' ) ) );
</del><ins>+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
</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;go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )-&gt;ID ) );
</del><ins>+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                // Comments aren't needed for this test to pass.
+                // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
+                $this-&gt;go_to( get_post_comments_feed_link( $post_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 = get_page_by_path( 'about' );
-                $this-&gt;go_to(get_permalink($page_id));
</del><ins>+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; '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 = get_page_by_path( 'parent-page' );
-                $this-&gt;go_to(get_permalink($page_id));
</del><ins>+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; '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 = get_page_by_path( 'parent-page/child-page-1' );
-                $this-&gt;go_to(get_permalink($page_id));
</del><ins>+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $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 = get_page_by_path( 'parent-page/child-page-1/child-page-2' );
-                $this-&gt;go_to(get_permalink($page_id));
</del><ins>+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                $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>-                foreach ($this-&gt;page_ids as $page_id) {
-                        $url = get_permalink($page_id);
</del><ins>+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $url = get_permalink( $page_id );
</ins><span class="cx">                         $this-&gt;go_to(&quot;{$url}trackback/&quot;);
</span><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="lines">@@ -165,8 +152,15 @@
</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>-                foreach ($this-&gt;page_ids as $page_id) {
-                        $url = get_permalink($page_id);
</del><ins>+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        // Comments aren't needed for this test to pass.
+                        // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+
+                        $url = get_permalink( $page_id );
</ins><span class="cx">                         $this-&gt;go_to(&quot;{$url}feed/&quot;);
</span><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="lines">@@ -181,8 +175,15 @@
</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>-                foreach ($this-&gt;page_ids as $page_id) {
-                        $url = get_permalink($page_id);
</del><ins>+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        // Comments aren't needed for this test to pass.
+                        // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+
+                        $url = get_permalink( $page_id );
</ins><span class="cx">                         $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
</span><span class="cx"> 
</span><span class="cx">                         // make sure the correct wp_query flags are set
</span><span class="lines">@@ -196,27 +197,44 @@
</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>-                foreach ($this-&gt;page_ids as $page_id) {
-                        $url = get_permalink($page_id);
-                        $this-&gt;go_to(&quot;{$url}page/2/&quot;);
</del><ins>+                $page_id = $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' ) );
+                $this-&gt;go_to(&quot;/about/page/2/&quot;);
</ins><span class="cx"> 
</span><del>-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
</del><ins>+                // make sure the correct wp_query flags are set
+                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
</ins><span class="cx"> 
</span><del>-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
</del><ins>+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
+        function test_page_page_2_no_slash() {
+                $page_id = $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' ) );
+                $this-&gt;go_to(&quot;/about/page2/&quot;);
+
+                // make sure the correct wp_query flags are set
+                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+        }
+        
</ins><span class="cx">         // FIXME: what is this for?
</span><span class="cx">         // '(about)(/[0-9]+)?/?$' =&gt; 'index.php?pagename=$matches[1]&amp;page=$matches[2]'
</span><del>-        function test_page_page_2_short() {
-                //return $this-&gt;markTestSkipped();
-                // identical to /about/page/2/ ?
</del><ins>+        function test_pagination_of_posts_page() {
+                $page_id = $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' ) );
+                update_option( 'show_on_front', 'page' );
+                update_option( 'page_for_posts', $page_id );
+
</ins><span class="cx">                 $this-&gt;go_to('/about/2/');
</span><span class="cx"> 
</span><del>-                $this-&gt;assertQueryTrue('is_page', 'is_singular');
</del><ins>+                $this-&gt;assertQueryTrue( 'is_home', 'is_posts_page' );
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // FIXME: no tests for these yet
</span><span class="lines">@@ -228,6 +246,7 @@
</span><span class="cx">         // 'feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
</span><span class="cx">         // '(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
</span><span class="cx">         function test_main_feed_2() {
</span><ins>+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
</ins><span class="cx">                 $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
</span><span class="cx"> 
</span><span class="cx">                 // long version
</span><span class="lines">@@ -245,6 +264,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_main_feed() {
</span><ins>+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
</ins><span class="cx">                 $types = array('rss2', 'rss', 'atom');
</span><span class="cx">                 foreach ($types as $type) {
</span><span class="cx">                         $this-&gt;go_to(get_feed_link($type));
</span><span class="lines">@@ -254,7 +274,8 @@
</span><span class="cx"> 
</span><span class="cx">         // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
</span><span class="cx">         function test_paged() {
</span><del>-                for ($i=2; $i&lt;4; $i++) {
</del><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 15 );
+                for ( $i = 2; $i &lt;= 3; $i++ ) {
</ins><span class="cx">                         $this-&gt;go_to(&quot;/page/{$i}/&quot;);
</span><span class="cx">                         $this-&gt;assertQueryTrue('is_home', 'is_paged');
</span><span class="cx">                 }
</span><span class="lines">@@ -263,8 +284,11 @@
</span><span class="cx">         // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
</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><ins>+                $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 );
+
</ins><span class="cx">                 // check the url as generated by get_post_comments_feed_link()
</span><del>-                $this-&gt;go_to( get_post_comments_feed_link( get_page_by_path( 'hello-world', OBJECT, 'post' )-&gt;ID ) );
</del><ins>+                $this-&gt;go_to( get_post_comments_feed_link( $post_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="lines">@@ -283,13 +307,6 @@
</span><span class="cx"> 
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // 'comments/page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
-        function test_comments_page() {
-                $this-&gt;go_to('/comments/page/2/');
-                $this-&gt;assertQueryTrue('is_home', 'is_paged');
-        }
-
-
</del><span class="cx">         // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         function test_search_feed() {
</span><span class="lines">@@ -310,6 +327,7 @@
</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><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_title' =&gt; 'test' ) );
</ins><span class="cx">                 $this-&gt;go_to('/search/test/page/2/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_search', 'is_paged');
</span><span class="cx">         }
</span><span class="lines">@@ -321,7 +339,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_search_encoded_chars() {
</span><del>-                $this-&gt;knownWPBug(13961);
</del><ins>+                // $this-&gt;knownWPBug(13961);
</ins><span class="cx">                 $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
</span><span class="cx">                 $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
</span><span class="cx">         }
</span><span class="lines">@@ -329,6 +347,7 @@
</span><span class="cx">         // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         function test_category_feed() {
</span><ins>+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
</ins><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><span class="lines">@@ -346,12 +365,14 @@
</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><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 10 );
</ins><span class="cx">                 $this-&gt;go_to('/category/uncategorized/page/2/');
</span><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><ins>+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
</ins><span class="cx">                 $this-&gt;go_to('/category/cat-a/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_category');
</span><span class="cx">         }
</span><span class="lines">@@ -359,6 +380,7 @@
</span><span class="cx">         // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         function test_tag_feed() {
</span><ins>+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
</ins><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><span class="lines">@@ -376,13 +398,17 @@
</span><span class="cx"> 
</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><del>-                $this-&gt;markTestSkipped(); // tag-a doesn't have enough posts -&gt; 404
</del><ins>+                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( 10 );
+                foreach ( $post_ids as $post_id )
+                        $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, 'tag-a', 'post_tag' );
+                // $this-&gt;markTestSkipped(); // tag-a doesn't have enough posts -&gt; 404
</ins><span class="cx">                 $this-&gt;go_to('/tag/tag-a/page/2/');
</span><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><ins>+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
</ins><span class="cx">                 $this-&gt;go_to('/tag/tag-a/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_tag');
</span><span class="cx">         }
</span><span class="lines">@@ -390,6 +416,7 @@
</span><span class="cx">         // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         function test_author_feed() {
</span><ins>+                $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
</ins><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><span class="lines">@@ -407,12 +434,17 @@
</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><ins>+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_author' =&gt; $user_id ) );
</ins><span class="cx">                 $this-&gt;go_to('/author/user-a/page/2/');
</span><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><ins>+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                // A post isn't needed for this test to pass.
+                // $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
</ins><span class="cx">                 $this-&gt;go_to('/author/user-a/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_author');
</span><span class="cx">         }
</span><span class="lines">@@ -420,6 +452,7 @@
</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;feed=$matches[4]',
</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;feed=$matches[4]',
</span><span class="cx">         function test_ymd_feed() {
</span><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><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><span class="lines">@@ -437,12 +470,14 @@
</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><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/09/04/page/2/');
</span><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><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/09/04/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
</span><span class="cx">         }
</span><span class="lines">@@ -450,6 +485,7 @@
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
</span><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
</span><span class="cx">         function test_ym_feed() {
</span><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><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><span class="lines">@@ -467,12 +503,14 @@
</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><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/09/page/2/');
</span><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><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/09/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
</span><span class="cx">         }
</span><span class="lines">@@ -480,6 +518,7 @@
</span><span class="cx">         // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
</span><span class="cx">         function test_y_feed() {
</span><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><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><span class="lines">@@ -497,60 +536,54 @@
</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><ins>+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/page/2/');
</span><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><ins>+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
</ins><span class="cx">                 $this-&gt;go_to('/2007/');
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
</del><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;post_ids as $post_id ) {
-                        $permalink = get_permalink( $post_id );
-                        $this-&gt;go_to(&quot;{$permalink}trackback/&quot;);
-                        $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_trackback');
-                }
</del><ins>+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $permalink = get_permalink( $post_id );
+                $this-&gt;go_to(&quot;{$permalink}trackback/&quot;);
+                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_trackback');
</ins><span class="cx">         }
</span><span class="cx"> 
</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;post_ids as $post_id ) {
-                        $permalink = get_permalink( $post_id );
</del><ins>+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $permalink = get_permalink( $post_id );
</ins><span class="cx"> 
</span><del>-                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                        foreach ($types as $type) {
-                                        $this-&gt;go_to(&quot;{$permalink}feed/{$type}&quot;);
-                                        $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                        }
</del><ins>+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;{$permalink}feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                }
</ins><span class="cx"> 
</span><del>-                        // check the short form
-                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                        foreach ($types as $type) {
-                                        $this-&gt;go_to(&quot;{$permalink}{$type}&quot;);
-                                        $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                        }
-
</del><ins>+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;{$permalink}{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // '([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;name=$matches[4]&amp;paged=$matches[5]',
-        function test_post_paged_long() {
-                $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1, plus /page/x isn't for single posts
-                // the long version
-                $this-&gt;go_to('/2007/09/04/a-post-with-multiple-pages/page/2/');
-                // should is_paged be true also?
-                $this-&gt;assertQueryTrue('is_single', 'is_singular');
-        }
-
</del><span class="cx">         // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;page=$matches[5]',
</span><span class="cx">         function test_post_paged_short() {
</span><del>-                $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1
</del><ins>+                $this-&gt;factory-&gt;post-&gt;create( array(
+                        'post_date' =&gt; '2007-09-04 00:00:00',
+                        'post_title' =&gt; 'a-post-with-multiple-pages',
+                        'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2'
+                ) );
+                // $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1
</ins><span class="cx">                 // and the short version
</span><span class="cx">                 $this-&gt;go_to('/2007/09/04/a-post-with-multiple-pages/2/');
</span><span class="cx">                 // should is_paged be true also?
</span><span class="lines">@@ -560,10 +593,10 @@
</span><span class="cx"> 
</span><span class="cx">         // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
</span><span class="cx">         function test_post_attachment() {
</span><del>-                $this-&gt;markTestSkipped(); // @todo ID 8 is a page in Data Set 1
-                $permalink = get_attachment_link(8);
</del><ins>+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'attachment' ) );
+                $permalink = get_attachment_link( $post_id );
</ins><span class="cx">                 $this-&gt;go_to($permalink);
</span><del>-                $this-&gt;assertQueryTrue('is_attachment', 'is_singular');
</del><ins>+                $this-&gt;assertQueryTrue('is_single', 'is_attachment', 'is_singular');
</ins><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?attachment=$matches[1]&amp;tb=1',
</span></span></pre>
</div>
</div>

</body>
</html>