<!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][1242] trunk/tests: Move tests/query.php to tests/query/conditionals.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://core.trac.wordpress.org/changeset/1242/tests">1242</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-03-13 02:24:49 +0000 (Wed, 13 Mar 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move tests/query.php to tests/query/conditionals.php. New query test for setup_postdata() pagination with nextpage. see <a href="http://core.trac.wordpress.org/ticket/16746">#16746</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsqueryverboseRewriteRulesphp">trunk/tests/query/verboseRewriteRules.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsqueryconditionalsphp">trunk/tests/query/conditionals.php</a></li>
<li><a href="#trunktestsqueryphp">trunk/tests/query.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsqueryphp">trunk/tests/query.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsqueryconditionalsphpfromrev1241trunktestsqueryphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/query/conditionals.php (from rev 1241, trunk/tests/query.php) (0 => 1242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query/conditionals.php                                (rev 0)
+++ trunk/tests/query/conditionals.php        2013-03-13 02:24:49 UTC (rev 1242)
</span><span class="lines">@@ -0,0 +1,632 @@
</span><ins>+&lt;?php
+
+/**
+ * Test the is_*() functions in query.php across the URL structure
+ *
+ * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
+ * then we test the effects of each url on the wp_query object.
+ *
+ * @group query
+ * @group rewrite
+ */
+class Tests_Query_Conditionals extends WP_UnitTestCase {
+
+        protected $page_ids;
+        protected $post_ids;
+
+        function setUp() {
+                parent::setUp();
+
+                update_option( 'comments_per_page', 5 );
+                update_option( 'posts_per_page', 5 );
+
+                global $wp_rewrite;
+                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
+                create_initial_taxonomies();
+                $GLOBALS['wp_rewrite']-&gt;init();
+                flush_rewrite_rules();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $GLOBALS['wp_rewrite']-&gt;init();
+        }
+
+        /**
+         * Check each of the WP_Query is_* functions/properties against expected boolean value.
+         *
+         * Any properties that are listed by name as parameters will be expected to be true; any others are
+         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
+         * and is_feed() must be true and everything else must be false to pass.
+         *
+         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
+         */
+        function assertQueryTrue(/* ... */) {
+                global $wp_query;
+                $all = array(
+                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
+                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
+                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
+                        'is_posts_page', 'is_post_type_archive',
+                );
+                $true = func_get_args();
+
+                $passed = true;
+                $not_false = $not_true = array(); // properties that were not set to expected values
+
+                foreach ( $all as $query_thing ) {
+                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query-&gt;$query_thing;
+
+                        if ( in_array( $query_thing, $true ) ) {
+                                if ( ! $result ) {
+                                        array_push( $not_true, $query_thing );
+                                        $passed = false;
+                                }
+                        } else if ( $result ) {
+                                array_push( $not_false, $query_thing );
+                                $passed = false;
+                        }
+                }
+
+                $message = '';
+                if ( count($not_true) )
+                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
+                if ( count($not_false) )
+                        $message .= implode( $not_false, ', ' ) . ' should be false.';
+                $this-&gt;assertTrue( $passed, $message );
+        }
+
+        function test_home() {
+                $this-&gt;go_to('/');
+                $this-&gt;assertQueryTrue('is_home');
+        }
+
+        function test_404() {
+                $this-&gt;go_to('/'.rand_str());
+                $this-&gt;assertQueryTrue('is_404');
+        }
+
+        function test_permalink() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertQueryTrue('is_single', 'is_singular');
+        }
+
+        function test_post_comments_feed() {
+                $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 );
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+
+        function test_post_comments_feed_with_no_comments() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+        function test_page() {
+                $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 ) );
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_parent_page() {
+                $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 ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_1() {
+                $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 ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_2() {
+                $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 ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        // '(about)/trackback/?$' =&gt; 'index.php?pagename=$matches[1]&amp;tb=1'
+        function test_page_trackback() {
+                $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 );
+                        $this-&gt;go_to(&quot;{$url}trackback/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page','is_singular','is_trackback');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
+        function test_page_feed() {
+                $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 ) {
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        function test_page_feed_with_no_comments() {
+                $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 );
+                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
+        function test_page_feed_atom() {
+                $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 ) {
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
+        function test_page_page_2() {
+                $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;);
+
+                // 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 );
+        }
+
+        // '(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 );
+        }
+
+        // FIXME: what is this for?
+        // '(about)(/[0-9]+)?/?$' =&gt; 'index.php?pagename=$matches[1]&amp;page=$matches[2]'
+        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 );
+
+                $this-&gt;go_to('/about/2/');
+
+                $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 );
+        }
+
+        // FIXME: no tests for these yet
+        // 'about/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        // 'about/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+
+        // 'feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
+        // '(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
+        function test_main_feed_2() {
+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
+                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+
+                // long version
+                foreach ($feeds as $feed) {
+                        $this-&gt;go_to(&quot;/feed/{$feed}/&quot;);
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+
+                // short version
+                foreach ($feeds as $feed) {
+                        $this-&gt;go_to(&quot;/{$feed}/&quot;);
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+
+        }
+
+        function test_main_feed() {
+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
+                $types = array('rss2', 'rss', 'atom');
+                foreach ($types as $type) {
+                        $this-&gt;go_to(get_feed_link($type));
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+        }
+
+        // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
+        function test_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 15 );
+                for ( $i = 2; $i &lt;= 3; $i++ ) {
+                        $this-&gt;go_to(&quot;/page/{$i}/&quot;);
+                        $this-&gt;assertQueryTrue('is_home', 'is_paged');
+                }
+        }
+
+        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
+        // 'comments/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
+        function test_main_comments_feed() {
+                $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 );
+
+                // check the url as generated by get_post_comments_feed_link()
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/comments/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/comments/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+        }
+
+        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
+        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
+        function test_search_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/search/test/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/search/test/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
+                }
+        }
+
+        // 'search/(.+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?s=$matches[1]&amp;paged=$matches[2]',
+        function test_search_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_title' =&gt; 'test' ) );
+                $this-&gt;go_to('/search/test/page/2/');
+                $this-&gt;assertQueryTrue('is_search', 'is_paged');
+        }
+
+        // 'search/(.+)/?$' =&gt; 'index.php?s=$matches[1]',
+        function test_search() {
+                $this-&gt;go_to('/search/test/');
+                $this-&gt;assertQueryTrue('is_search');
+        }
+
+        /**
+         * @ticket 13961
+         */
+        function test_search_encoded_chars() {
+                $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
+                $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
+        }
+
+        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
+        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
+        function test_category_feed() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/category/cat-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/category/cat-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+        }
+
+        // 'category/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?category_name=$matches[1]&amp;paged=$matches[2]',
+        function test_category_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10 );
+                $this-&gt;go_to('/category/uncategorized/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_category', 'is_paged');
+        }
+
+        // 'category/(.+?)/?$' =&gt; 'index.php?category_name=$matches[1]',
+        function test_category() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
+                $this-&gt;go_to('/category/cat-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_category');
+        }
+
+        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
+        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
+        function test_tag_feed() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/tag/tag-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/tag/tag-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+        }
+
+        // 'tag/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?tag=$matches[1]&amp;paged=$matches[2]',
+        function test_tag_paged() {
+                $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;go_to('/tag/tag-a/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_tag', 'is_paged');
+        }
+
+        // 'tag/(.+?)/?$' =&gt; 'index.php?tag=$matches[1]',
+        function test_tag() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
+                $this-&gt;go_to('/tag/tag-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_tag');
+        }
+
+        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
+        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
+        function test_author_feed() {
+                $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/author/user-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/author/user-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+        }
+
+        // 'author/([^/]+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?author_name=$matches[1]&amp;paged=$matches[2]',
+        function test_author_paged() {
+                $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 ) );
+                $this-&gt;go_to('/author/user-a/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author', 'is_paged');
+        }
+
+        // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
+        function test_author() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
+                $this-&gt;go_to('/author/user-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author');
+        }
+
+        function test_author_with_no_posts() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;go_to('/author/user-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author');
+        }
+
+        // '([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]',
+        // '([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]',
+        function test_ymd_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/04/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/04/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+        }
+
+        // '([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]',
+        function test_ymd_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/04/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
+        }
+
+        // '([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]',
+        function test_ymd() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/04/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
+        }
+
+        // '([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]',
+        // '([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]',
+        function test_ym_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+        }
+
+        // '([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]',
+        function test_ym_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]',
+        function test_ym() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
+        }
+
+        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
+        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
+        function test_y_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;paged=$matches[2]',
+        function test_y_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
+        }
+
+        // '([0-9]{4})/?$' =&gt; 'index.php?year=$matches[1]',
+        function test_y() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
+        }
+
+        // '([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',
+        function test_post_trackback() {
+                $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');
+        }
+
+        // '([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]',
+        // '([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]',
+        function test_post_comment_feed() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $permalink = get_permalink( $post_id );
+
+                $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');
+                }
+
+                // 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');
+                }
+        }
+
+        // '([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]',
+        function test_post_paged_short() {
+                $post_id = $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;go_to( get_permalink( $post_id ) . '2/' );
+                // should is_paged be true also?
+                $this-&gt;assertQueryTrue('is_single', 'is_singular');
+
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        function test_post_attachment() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'attachment' ) );
+                $permalink = get_attachment_link( $post_id );
+                $this-&gt;go_to($permalink);
+                $this-&gt;assertQueryTrue('is_single', 'is_attachment', 'is_singular');
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+}
</ins></span></pre></div>
<a id="trunktestsqueryverboseRewriteRulesphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/query/verboseRewriteRules.php (1241 => 1242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query/verboseRewriteRules.php        2013-03-08 20:31:37 UTC (rev 1241)
+++ trunk/tests/query/verboseRewriteRules.php        2013-03-13 02:24:49 UTC (rev 1242)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx">  * @group query
</span><span class="cx">  * @group rewrite
</span><span class="cx">  */
</span><del>-class Tests_Query_VerbosePageRules extends Tests_Query {
</del><ins>+class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
</ins><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">                 global $wp_rewrite;
</span></span></pre></div>
<a id="trunktestsqueryphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/query.php (1241 => 1242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query.php        2013-03-08 20:31:37 UTC (rev 1241)
+++ trunk/tests/query.php        2013-03-13 02:24:49 UTC (rev 1242)
</span><span class="lines">@@ -1,632 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test the is_*() functions in query.php across the URL structure
- *
- * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
- * then we test the effects of each url on the wp_query object.
- *
- * @group query
- * @group rewrite
- */
-class Tests_Query extends WP_UnitTestCase {
-
-        protected $page_ids;
-        protected $post_ids;
-
-        function setUp() {
-                parent::setUp();
-
-                update_option( 'comments_per_page', 5 );
-                update_option( 'posts_per_page', 5 );
-
-                global $wp_rewrite;
-                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
-                create_initial_taxonomies();
-                $GLOBALS['wp_rewrite']-&gt;init();
-                flush_rewrite_rules();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $GLOBALS['wp_rewrite']-&gt;init();
-        }
-
-        /**
-         * Check each of the WP_Query is_* functions/properties against expected boolean value.
-         *
-         * Any properties that are listed by name as parameters will be expected to be true; any others are
-         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
-         * and is_feed() must be true and everything else must be false to pass.
-         *
-         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
-         */
-        function assertQueryTrue(/* ... */) {
-                global $wp_query;
-                $all = array(
-                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
-                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
-                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
-                        'is_posts_page', 'is_post_type_archive',
-                );
-                $true = func_get_args();
-
-                $passed = true;
-                $not_false = $not_true = array(); // properties that were not set to expected values
-
-                foreach ( $all as $query_thing ) {
-                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query-&gt;$query_thing;
-
-                        if ( in_array( $query_thing, $true ) ) {
-                                if ( ! $result ) {
-                                        array_push( $not_true, $query_thing );
-                                        $passed = false;
-                                }
-                        } else if ( $result ) {
-                                array_push( $not_false, $query_thing );
-                                $passed = false;
-                        }
-                }
-
-                $message = '';
-                if ( count($not_true) )
-                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
-                if ( count($not_false) )
-                        $message .= implode( $not_false, ', ' ) . ' should be false.';
-                $this-&gt;assertTrue( $passed, $message );
-        }
-
-        function test_home() {
-                $this-&gt;go_to('/');
-                $this-&gt;assertQueryTrue('is_home');
-        }
-
-        function test_404() {
-                $this-&gt;go_to('/'.rand_str());
-                $this-&gt;assertQueryTrue('is_404');
-        }
-
-        function test_permalink() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertQueryTrue('is_single', 'is_singular');
-        }
-
-        function test_post_comments_feed() {
-                $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 );
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-
-        function test_post_comments_feed_with_no_comments() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-        function test_page() {
-                $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 ) );
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_parent_page() {
-                $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 ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_1() {
-                $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 ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_2() {
-                $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 ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        // '(about)/trackback/?$' =&gt; 'index.php?pagename=$matches[1]&amp;tb=1'
-        function test_page_trackback() {
-                $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 );
-                        $this-&gt;go_to(&quot;{$url}trackback/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page','is_singular','is_trackback');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
-        function test_page_feed() {
-                $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 ) {
-                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        function test_page_feed_with_no_comments() {
-                $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 );
-                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
-        function test_page_feed_atom() {
-                $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 ) {
-                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
-
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
-        function test_page_page_2() {
-                $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;);
-
-                // 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 );
-        }
-
-        // '(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 );
-        }
-
-        // FIXME: what is this for?
-        // '(about)(/[0-9]+)?/?$' =&gt; 'index.php?pagename=$matches[1]&amp;page=$matches[2]'
-        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 );
-
-                $this-&gt;go_to('/about/2/');
-
-                $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 );
-        }
-
-        // FIXME: no tests for these yet
-        // 'about/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        // 'about/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-
-        // 'feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
-        // '(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
-        function test_main_feed_2() {
-                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
-                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-
-                // long version
-                foreach ($feeds as $feed) {
-                        $this-&gt;go_to(&quot;/feed/{$feed}/&quot;);
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-
-                // short version
-                foreach ($feeds as $feed) {
-                        $this-&gt;go_to(&quot;/{$feed}/&quot;);
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-
-        }
-
-        function test_main_feed() {
-                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
-                $types = array('rss2', 'rss', 'atom');
-                foreach ($types as $type) {
-                        $this-&gt;go_to(get_feed_link($type));
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-        }
-
-        // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
-        function test_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 15 );
-                for ( $i = 2; $i &lt;= 3; $i++ ) {
-                        $this-&gt;go_to(&quot;/page/{$i}/&quot;);
-                        $this-&gt;assertQueryTrue('is_home', 'is_paged');
-                }
-        }
-
-        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
-        // 'comments/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
-        function test_main_comments_feed() {
-                $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 );
-
-                // check the url as generated by get_post_comments_feed_link()
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/comments/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/comments/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-        }
-
-        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
-        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
-        function test_search_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/search/test/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/search/test/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
-                }
-        }
-
-        // 'search/(.+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?s=$matches[1]&amp;paged=$matches[2]',
-        function test_search_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_title' =&gt; 'test' ) );
-                $this-&gt;go_to('/search/test/page/2/');
-                $this-&gt;assertQueryTrue('is_search', 'is_paged');
-        }
-
-        // 'search/(.+)/?$' =&gt; 'index.php?s=$matches[1]',
-        function test_search() {
-                $this-&gt;go_to('/search/test/');
-                $this-&gt;assertQueryTrue('is_search');
-        }
-
-        /**
-         * @ticket 13961
-         */
-        function test_search_encoded_chars() {
-                $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
-                $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
-        }
-
-        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
-        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
-        function test_category_feed() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/category/cat-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/category/cat-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-        }
-
-        // 'category/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?category_name=$matches[1]&amp;paged=$matches[2]',
-        function test_category_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10 );
-                $this-&gt;go_to('/category/uncategorized/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_category', 'is_paged');
-        }
-
-        // 'category/(.+?)/?$' =&gt; 'index.php?category_name=$matches[1]',
-        function test_category() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
-                $this-&gt;go_to('/category/cat-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_category');
-        }
-
-        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
-        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
-        function test_tag_feed() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/tag/tag-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/tag/tag-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-        }
-
-        // 'tag/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?tag=$matches[1]&amp;paged=$matches[2]',
-        function test_tag_paged() {
-                $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;go_to('/tag/tag-a/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_tag', 'is_paged');
-        }
-
-        // 'tag/(.+?)/?$' =&gt; 'index.php?tag=$matches[1]',
-        function test_tag() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
-                $this-&gt;go_to('/tag/tag-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_tag');
-        }
-
-        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
-        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
-        function test_author_feed() {
-                $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/author/user-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/author/user-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-        }
-
-        // 'author/([^/]+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?author_name=$matches[1]&amp;paged=$matches[2]',
-        function test_author_paged() {
-                $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 ) );
-                $this-&gt;go_to('/author/user-a/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author', 'is_paged');
-        }
-
-        // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
-        function test_author() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
-                $this-&gt;go_to('/author/user-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author');
-        }
-
-        function test_author_with_no_posts() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                $this-&gt;go_to('/author/user-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author');
-        }
-
-        // '([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]',
-        // '([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]',
-        function test_ymd_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/04/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/04/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-        }
-
-        // '([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]',
-        function test_ymd_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/04/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
-        }
-
-        // '([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]',
-        function test_ymd() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/04/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
-        }
-
-        // '([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]',
-        // '([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]',
-        function test_ym_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-        }
-
-        // '([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]',
-        function test_ym_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]',
-        function test_ym() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
-        }
-
-        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
-        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
-        function test_y_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;paged=$matches[2]',
-        function test_y_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
-        }
-
-        // '([0-9]{4})/?$' =&gt; 'index.php?year=$matches[1]',
-        function test_y() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
-        }
-
-        // '([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',
-        function test_post_trackback() {
-                $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');
-        }
-
-        // '([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]',
-        // '([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]',
-        function test_post_comment_feed() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $permalink = get_permalink( $post_id );
-
-                $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');
-                }
-
-                // 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');
-                }
-        }
-
-        // '([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]',
-        function test_post_paged_short() {
-                $post_id = $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;go_to( get_permalink( $post_id ) . '2/' );
-                // should is_paged be true also?
-                $this-&gt;assertQueryTrue('is_single', 'is_singular');
-
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        function test_post_attachment() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'attachment' ) );
-                $permalink = get_attachment_link( $post_id );
-                $this-&gt;go_to($permalink);
-                $this-&gt;assertQueryTrue('is_single', 'is_attachment', 'is_singular');
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-}
</del></span></pre></div>
<a id="trunktestsqueryphp"></a>
<div class="addfile"><h4>Added: trunk/tests/query.php (0 => 1242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query.php                                (rev 0)
+++ trunk/tests/query.php        2013-03-13 02:24:49 UTC (rev 1242)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;?php
+
+class Tests_Query extends WP_UnitTestCase {
+
+        /**
+         * @ticket 16746
+         */
+        function test_nextpage_at_start_of_content() {
+                $post = $this-&gt;factory-&gt;post-&gt;create_and_get( array( 'post_content' =&gt; '&lt;!--nextpage--&gt;Page 1&lt;!--nextpage--&gt;Page 2&lt;!--nextpage--&gt;Page 3' ) );
+                setup_postdata( $post );
+
+                $this-&gt;assertEquals( 1, $GLOBALS['multipage'] );
+                $this-&gt;assertCount(  3, $GLOBALS['pages']     );
+                $this-&gt;assertEquals( 3, $GLOBALS['numpages']  );
+                $this-&gt;assertEquals( array( 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>