<!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][865] trunk: For query tests that don't require a post (or comment) to pass, test twice - with and without posts/comments.</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/865">865</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-02 18:15:04 +0000 (Mon, 02 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>For query tests that don't require a post (or comment) to pass, test twice - with and without posts/comments.

Remove cruft. Uncomment knownWPBug (it passes in 3.5, but the ticket is currently open for discussion).

Remove @ticket, as these get picked up as groups.

Exclude final file to be ported, this time with a relative path. see <a href="http://unit-tests.trac.wordpress.org/ticket/97">#97</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkphpunitxml">trunk/phpunit.xml</a></li>
<li><a href="#trunkwptestcasetest_includes_formattingphp">trunk/wp-testcase/test_includes_formatting.php</a></li>
<li><a href="#trunkwptestcasetest_queryphp">trunk/wp-testcase/test_query.php</a></li>
<li><a href="#trunkwptestcasetest_userphp">trunk/wp-testcase/test_user.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkphpunitxml"></a>
<div class="modfile"><h4>Modified: trunk/phpunit.xml (864 => 865)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/phpunit.xml        2012-07-02 18:01:36 UTC (rev 864)
+++ trunk/phpunit.xml        2012-07-02 18:15:04 UTC (rev 865)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx">         &lt;!-- Default test suite to run all tests --&gt;
</span><span class="cx">         &lt;testsuite&gt;
</span><span class="cx">             &lt;directory suffix=&quot;.php&quot;&gt;wp-testcase&lt;/directory&gt;
</span><ins>+            &lt;exclude&gt;wp-testcase/test_query_results.php&lt;/exclude&gt;
</ins><span class="cx">         &lt;/testsuite&gt;
</span><span class="cx">     &lt;/testsuites&gt;
</span><span class="cx"> &lt;/phpunit&gt;
</span></span></pre></div>
<a id="trunkwptestcasetest_includes_formattingphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test_includes_formatting.php (864 => 865)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_includes_formatting.php        2012-07-02 18:01:36 UTC (rev 864)
+++ trunk/wp-testcase/test_includes_formatting.php        2012-07-02 18:15:04 UTC (rev 865)
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * @ticket 16892
</del><ins>+         * ticket 16892
</ins><span class="cx">          */
</span><span class="cx">         function test_no_segfault() {
</span><span class="cx">                 if ( version_compare( $GLOBALS['wp_version'], '3.1.1', '&lt;' ) )
</span></span></pre></div>
<a id="trunkwptestcasetest_queryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test_query.php (864 => 865)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_query.php        2012-07-02 18:01:36 UTC (rev 864)
+++ trunk/wp-testcase/test_query.php        2012-07-02 18:15:04 UTC (rev 865)
</span><span class="lines">@@ -32,11 +32,6 @@
</span><span class="cx">                 $GLOBALS['wp_rewrite']-&gt;init();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function _all_post_ids( $type='post' ) {
-                global $wpdb;
-                return $wpdb-&gt;get_col( $wpdb-&gt;prepare( &quot;SELECT ID FROM {$wpdb-&gt;posts} WHERE post_type = %s and post_status='publish'&quot;, $type ) );
-        }
-
</del><span class="cx">         /**
</span><span class="cx">          * Check each of the WP_Query is_* functions/properties against expected boolean value.
</span><span class="cx">          *
</span><span class="lines">@@ -99,12 +94,18 @@
</span><span class="cx"> 
</span><span class="cx">         function test_post_comments_feed() {
</span><span class="cx">                 $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
</span><del>-                // Comments aren't needed for this test to pass.
-                // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
</del><ins>+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
</ins><span class="cx">                 $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
</span><span class="cx">                 $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+
+        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');
+        }
+
</ins><span class="cx">         function test_page() {
</span><span class="cx">                 $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about' ) );
</span><span class="cx">                 $this-&gt;go_to( get_permalink( $page_id ) );
</span><span class="lines">@@ -161,9 +162,25 @@
</span><span class="cx">                 $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 ) );
</span><span class="cx">                 $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 ) );
</span><span class="cx">                 foreach ( $page_ids as $page_id ) {
</span><del>-                        // Comments aren't needed for this test to pass.
-                        // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
</del><ins>+                        $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;);
</ins><span class="cx"> 
</span><ins>+                        // 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 ) {
</ins><span class="cx">                         $url = get_permalink( $page_id );
</span><span class="cx">                         $this-&gt;go_to(&quot;{$url}feed/&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -174,7 +191,6 @@
</span><span class="cx">                         global $wp_query;
</span><span class="cx">                         $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
</span><span class="cx">                 }
</span><del>-
</del><span class="cx">         }
</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="lines">@@ -184,8 +200,7 @@
</span><span class="cx">                 $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 ) );
</span><span class="cx">                 $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 ) );
</span><span class="cx">                 foreach ( $page_ids as $page_id ) {
</span><del>-                        // Comments aren't needed for this test to pass.
-                        // $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
</del><ins>+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
</ins><span class="cx"> 
</span><span class="cx">                         $url = get_permalink( $page_id );
</span><span class="cx">                         $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
</span><span class="lines">@@ -343,7 +358,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">@@ -405,7 +420,6 @@
</span><span class="cx">                 $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( 10 );
</span><span class="cx">                 foreach ( $post_ids as $post_id )
</span><span class="cx">                         $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, 'tag-a', 'post_tag' );
</span><del>-                // $this-&gt;markTestSkipped(); // tag-a doesn't have enough posts -&gt; 404
</del><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="lines">@@ -447,12 +461,17 @@
</span><span class="cx">         // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
</span><span class="cx">         function test_author() {
</span><span class="cx">                 $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
</span><del>-                // A post isn't needed for this test to pass.
-                // $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
</del><ins>+                $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="cx"> 
</span><ins>+        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');
+        }
+
</ins><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><span class="lines">@@ -587,8 +606,6 @@
</span><span class="cx">                         'post_title' =&gt; 'a-post-with-multiple-pages',
</span><span class="cx">                         'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2'
</span><span class="cx">                 ) );
</span><del>-                // $this-&gt;markTestSkipped(); // @todo post doesn't exist in Data Set 1
-                // and the short version
</del><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="cx">                 $this-&gt;assertQueryTrue('is_single', 'is_singular');
</span></span></pre></div>
<a id="trunkwptestcasetest_userphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test_user.php (864 => 865)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test_user.php        2012-07-02 18:01:36 UTC (rev 864)
+++ trunk/wp-testcase/test_user.php        2012-07-02 18:15:04 UTC (rev 865)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * @ticket 19265
</del><ins>+         * ticket 19265
</ins><span class="cx">          */
</span><span class="cx">         function test_user_level_property_back_compat() {
</span><span class="cx">                 $roles = array(
</span><span class="lines">@@ -380,7 +380,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * @ticket 19595
</del><ins>+         * ticket 19595
</ins><span class="cx">          */
</span><span class="cx">         function test_global_userdata() {
</span><span class="cx">                 global $userdata, $wpdb;
</span><span class="lines">@@ -397,7 +397,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><del>-         * @ticket 19769
</del><ins>+         * ticket 19769
</ins><span class="cx">          */
</span><span class="cx">         function test_global_userdata_is_null_when_logged_out() {
</span><span class="cx">                 global $userdata;
</span></span></pre>
</div>
</div>

</body>
</html>