<!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>[29794] trunk/tests/phpunit/tests: Fix file location for WP_Date_Query tests introduced in r29793.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/29794">29794</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/29794","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>boonebgorges</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-09-29 16:19:53 +0000 (Mon, 29 Sep 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Fix file location for WP_Date_Query tests introduced in <a href="https://core.trac.wordpress.org/changeset/29793">r29793</a>.

See <a href="https://core.trac.wordpress.org/ticket/29781">#29781</a></pre>

<h3>Added Paths</h3>
<ul>
<li>trunk/tests/phpunit/tests/date/</li>
<li><a href="#trunktestsphpunittestsdatequeryphp">trunk/tests/phpunit/tests/date/query.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsdatephp">trunk/tests/phpunit/tests/date.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsdatequeryphpfromrev29793trunktestsphpunittestsdatephp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/tests/phpunit/tests/date/query.php (from rev 29793, trunk/tests/phpunit/tests/date.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/date/query.php                          (rev 0)
+++ trunk/tests/phpunit/tests/date/query.php    2014-09-29 16:19:53 UTC (rev 29794)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,577 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * Tests for public methods of WP_Date_Query.
+ *
+ * See query/dateQuery.php for tests that require WP_Query.
+ *
+ * @group datequery
+ * @group date
+ */
+class Tests_WP_Date_Query extends WP_UnitTestCase {
+       public function test_construct_date_query_empty() {
+               $q = new WP_Date_Query( array() );
+               $this->assertSame( 'AND', $q->relation );
+               $this->assertSame( 'post_date', $q->column );
+               $this->assertSame( '=', $q->compare );
+               $this->assertSame( array(), $q->queries );
+       }
+
+       public function test_construct_date_query_non_array() {
+               $q = new WP_Date_Query( 'foo' );
+               $this->assertSame( 'AND', $q->relation );
+               $this->assertSame( 'post_date', $q->column );
+               $this->assertSame( '=', $q->compare );
+               $this->assertSame( array(), $q->queries );
+       }
+
+       public function test_construct_relation_or_lowercase() {
+               $q = new WP_Date_Query( array(
+                       'relation' => 'or',
+               ) );
+
+               $this->assertSame( 'OR', $q->relation );
+       }
+
+       public function test_construct_relation_invalid() {
+               $q = new WP_Date_Query( array(
+                       'relation' => 'foo',
+               ) );
+
+               $this->assertSame( 'AND', $q->relation );
+       }
+
+       public function test_construct_query_not_an_array_of_arrays() {
+               $q = new WP_Date_Query( array(
+                       'before' => array(
+                               'year' => 2008,
+                               'month' => 6,
+                       ),
+               ) );
+
+               $expected = array(
+                       0 => array(
+                               'before' => array(
+                                       'year' => 2008,
+                                       'month' => 6,
+                               ),
+                       ),
+               );
+
+               $this->assertSame( $expected, $q->queries );
+       }
+
+       public function test_construct_query_contains_non_arrays() {
+               $q = new WP_Date_Query( array(
+                       'foo',
+                       'bar',
+                       array(
+                               'before' => array(
+                                       'year' => 2008,
+                                       'month' => 6,
+                               ),
+                       ),
+               ) );
+
+               // Note: WP_Date_Query does not reset indexes
+               $expected = array(
+                       2 => array(
+                               'before' => array(
+                                       'year' => 2008,
+                                       'month' => 6,
+                               ),
+                       ),
+               );
+
+               $this->assertSame( $expected, $q->queries );
+       }
+
+       public function test_get_compare_empty() {
+               $q = new WP_Date_Query( array() );
+               $this->assertSame( '=', $q->get_compare( array() ) );
+       }
+
+       public function test_get_compare_equals() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '=',
+               ) );
+               $this->assertSame( '=', $found );
+       }
+
+       public function test_get_compare_not_equals() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '!=',
+               ) );
+               $this->assertSame( '!=', $found );
+       }
+
+       public function test_get_compare_greater_than() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '>',
+               ) );
+               $this->assertSame( '>', $found );
+       }
+
+       public function test_get_compare_greater_than_or_equal_to() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '>=',
+               ) );
+               $this->assertSame( '>=', $found );
+       }
+
+       public function test_get_compare_less_than() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '<',
+               ) );
+               $this->assertSame( '<', $found );
+       }
+
+       public function test_get_compare_less_than_or_equal_to() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => '<=',
+               ) );
+               $this->assertSame( '<=', $found );
+       }
+
+       public function test_get_compare_in() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => 'IN',
+               ) );
+               $this->assertSame( 'IN', $found );
+       }
+
+       public function test_get_compare_not_in() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => 'NOT IN',
+               ) );
+               $this->assertSame( 'NOT IN', $found );
+       }
+
+       public function test_get_compare_between() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => 'BETWEEN',
+               ) );
+               $this->assertSame( 'BETWEEN', $found );
+       }
+
+       public function test_get_compare_not_between() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->get_compare( array(
+                       'compare' => 'BETWEEN',
+               ) );
+               $this->assertSame( 'BETWEEN', $found );
+       }
+
+       public function test_validate_column_post_date() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'post_date', $q->validate_column( 'post_date' ) );
+       }
+
+       public function test_validate_column_post_date_gmt() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'post_date_gmt', $q->validate_column( 'post_date_gmt' ) );
+       }
+
+       public function test_validate_column_post_modified() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'post_modified', $q->validate_column( 'post_modified' ) );
+       }
+
+       public function test_validate_column_post_modified_gmt() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) );
+       }
+
+       public function test_validate_column_comment_date() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'comment_date', $q->validate_column( 'comment_date' ) );
+       }
+
+       public function test_validate_column_comment_date_gmt() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) );
+       }
+
+       public function test_validate_column_invalid() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertSame( 'post_date', $q->validate_column( 'foo' ) );
+       }
+
+       public function test_build_value_value_null() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertFalse( $q->build_value( 'foo', null ) );
+       }
+
+       public function test_build_value_compare_in() {
+               $q = new WP_Date_Query( array() );
+
+               // Single integer
+               $found = $q->build_value( 'IN', 4 );
+               $this->assertSame( '(4)', $found );
+
+               // Single non-integer
+               $found = $q->build_value( 'IN', 'foo' );
+               $this->assertSame( '(0)', $found );
+
+               // Array of integers
+               $found = $q->build_value( 'IN', array( 1, 4, 7 ) );
+               $this->assertSame( '(1,4,7)', $found );
+
+               // Array containing non-integers
+               $found = $q->build_value( 'IN', array( 1, 'foo', 7 ) );
+               $this->assertSame( '(1,0,7)', $found );
+       }
+
+       public function test_build_value_compare_not_in() {
+               $q = new WP_Date_Query( array() );
+
+               // Single integer
+               $found = $q->build_value( 'NOT IN', 4 );
+               $this->assertSame( '(4)', $found );
+
+               // Single non-integer
+               $found = $q->build_value( 'NOT IN', 'foo' );
+               $this->assertSame( '(0)', $found );
+
+               // Array of integers
+               $found = $q->build_value( 'NOT IN', array( 1, 4, 7 ) );
+               $this->assertSame( '(1,4,7)', $found );
+
+               // Array containing non-integers
+               $found = $q->build_value( 'NOT IN', array( 1, 'foo', 7 ) );
+               $this->assertSame( '(1,0,7)', $found );
+       }
+
+       public function test_build_value_compare_between_single_integer() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', 4 );
+               $this->assertSame( '4 AND 4', $found );
+       }
+
+       /**
+        * @todo This is a bug. Should return false when non-numeric
+        */
+       public function test_build_value_compare_between_single_non_numeric() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', 'foo' );
+               $this->assertSame( '0 AND 0', $found );
+       }
+
+       /**
+        * @todo This is a bug
+        */
+       public function test_build_value_compare_between_array_with_other_than_two_items() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', array( 2, 3, 4 ) );
+
+               // array_map( 'intval', array(
+               //     array( 2, 3, 4 ),
+               //     array( 2, 3, 4 ),
+               // ) );
+               $this->assertSame( '1 AND 1', $found );
+       }
+
+       /**
+        * @todo This is a bug
+        */
+       public function test_build_value_compare_between_incorrect_array_key() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', array(
+                       2 => 4,
+                       3 => 5,
+               ) );
+
+               // array_map( 'intval', array(
+               //     array( 2 => 4, 3 => 5 ),
+               //     array( 2 => 4, 3 => 5 ),
+               // ) );
+               $this->assertSame( '1 AND 1', $found );
+       }
+
+       public function test_build_value_compare_between_array_contains_non_numeric() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', array( 2, 'foo' ) );
+               $this->assertSame( '2 AND 0', $found );
+       }
+
+       public function test_build_value_compare_between() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'BETWEEN', array( 2, 3 ) );
+               $this->assertSame( '2 AND 3', $found );
+       }
+
+       public function test_build_value_compare_not_between_single_integer() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', 4 );
+               $this->assertSame( '4 AND 4', $found );
+       }
+
+       public function test_build_value_compare_not_between_single_non_numeric() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', 'foo' );
+               $this->assertSame( '0 AND 0', $found );
+       }
+
+       /**
+        * @todo This is a bug
+        */
+       public function test_build_value_compare_not_between_array_with_other_than_two_items() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', array( 2, 3, 4 ) );
+
+               // array_map( 'intval', array(
+               //     array( 2, 3, 4 ),
+               //     array( 2, 3, 4 ),
+               // ) );
+               $this->assertSame( '1 AND 1', $found );
+       }
+
+       /**
+        * @todo This is a bug
+        */
+       public function test_build_value_compare_not_between_incorrect_array_key() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', array(
+                       2 => 4,
+                       3 => 5,
+               ) );
+
+               // array_map( 'intval', array(
+               //     array( 2 => 4, 3 => 5 ),
+               //     array( 2 => 4, 3 => 5 ),
+               // ) );
+               $this->assertSame( '1 AND 1', $found );
+       }
+
+       public function test_build_value_compare_not_between_array_contains_non_numeric() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', array( 2, 'foo' ) );
+               $this->assertSame( '2 AND 0', $found );
+       }
+
+       public function test_build_value_compare_not_between() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'NOT BETWEEN', array( 2, 3 ) );
+               $this->assertSame( '2 AND 3', $found );
+       }
+
+       public function test_build_value_compare_default_value_integer() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'foo', 5 );
+               $this->assertSame( 5, $found );
+       }
+
+       /**
+        * @todo This is probably a bug - ought to return false
+        */
+       public function test_build_value_compare_default_value_non_numeric() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_value( 'foo', 'foo' );
+               $this->assertSame( 0, $found );
+       }
+
+       public function test_build_mysql_datetime_datetime_non_array() {
+               $q = new WP_Date_Query( array() );
+
+               // This might be a fragile test if it takes longer than 1 second to run
+               $found = $q->build_mysql_datetime( 'foo' );
+               $expected = gmdate( 'Y-m-d H:i:s', strtotime( current_time( 'timestamp' ) ) );
+               $this->assertSame( $found, $expected );
+       }
+
+       public function test_build_mysql_datetime_default_to_max_true() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_mysql_datetime( array(
+                       'year' => 2011,
+               ), true );
+               $this->assertSame( '2011-12-31 23:59:59', $found );
+       }
+
+       public function test_build_mysql_datetime_default_to_max_false() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_mysql_datetime( array(
+                       'year' => 2011,
+               ), false );
+               $this->assertSame( '2011-01-01 00:00:00', $found );
+       }
+
+       public function test_build_mysql_datetime_default_to_max_default_to_false() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_mysql_datetime( array(
+                       'year' => 2011,
+               ), false );
+               $this->assertSame( '2011-01-01 00:00:00', $found );
+       }
+
+       public function test_build_time_query_insufficient_time_values() {
+               $q = new WP_Date_Query( array() );
+
+               $this->assertFalse( $q->build_time_query( 'post_date', '=' ) );
+       }
+
+       public function test_build_time_query_compare_in() {
+               $q = new WP_Date_Query( array() );
+
+               // Just hour
+               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ) );
+               $this->assertSame( 'HOUR( post_date ) IN (1,2)', $found );
+
+               // Skip minute
+               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), null, 6 );
+               $this->assertSame( 'HOUR( post_date ) IN (1,2) AND SECOND( post_date ) IN (6)', $found );
+
+               // All three
+               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
+               $this->assertSame( 'HOUR( post_date ) IN (1,2) AND MINUTE( post_date ) IN (3,4,5) AND SECOND( post_date ) IN (6)', $found );
+       }
+
+       public function test_build_time_query_compare_not_in() {
+               $q = new WP_Date_Query( array() );
+
+               // Just hour
+               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ) );
+               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2)', $found );
+
+               // Skip minute
+               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), null, 6 );
+               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND SECOND( post_date ) NOT IN (6)', $found );
+
+               // All three
+               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
+               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND MINUTE( post_date ) NOT IN (3,4,5) AND SECOND( post_date ) NOT IN (6)', $found );
+       }
+
+       public function test_build_time_query_compare_between() {
+               $q = new WP_Date_Query( array() );
+
+               // Just hour
+               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ) );
+               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2', $found );
+
+               // Skip minute
+               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
+               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
+
+               // All three
+               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
+               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND MINUTE( post_date ) BETWEEN 3 AND 4 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
+       }
+
+       public function test_build_time_query_compare_not_between() {
+               $q = new WP_Date_Query( array() );
+
+               // Just hour
+               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ) );
+               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2', $found );
+
+               // Skip minute
+               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
+               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
+
+               // All three
+               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
+               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND MINUTE( post_date ) NOT BETWEEN 3 AND 4 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
+       }
+
+       public function test_build_time_query_hour_only() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', 5 );
+               $this->assertSame( 'HOUR( post_date ) = 5', $found );
+       }
+
+       public function test_build_time_query_minute_only() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', null, 5 );
+               $this->assertSame( 'MINUTE( post_date ) = 5', $found );
+       }
+
+       public function test_build_time_query_second_only() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', null, null, 5 );
+               $this->assertSame( 'SECOND( post_date ) = 5', $found );
+       }
+
+       public function test_build_time_query_hour_and_second() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', 5, null, 5 );
+               $this->assertFalse( $found );
+       }
+
+       public function test_build_time_query_hour_minute() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', 5, 15 );
+
+               // $compare value is floating point - use regex to account for
+               // varying precision on different PHP installations
+               $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $found );
+       }
+
+       public function test_build_time_query_hour_minute_second() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', 5, 15, 35 );
+
+               // $compare value is floating point - use regex to account for
+               // varying precision on different PHP installations
+               $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $found );
+       }
+
+       public function test_build_time_query_minute_second() {
+               $q = new WP_Date_Query( array() );
+
+               $found = $q->build_time_query( 'post_date', '=', null, 15, 35 );
+
+               // $compare value is floating point - use regex to account for
+               // varying precision on different PHP installations
+               $this->assertRegExp( "/DATE_FORMAT\( post_date, '0\.%i%s' \) = 0\.15350*/", $found );
+       }
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsdatephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/date.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/date.php        2014-09-29 16:04:46 UTC (rev 29793)
+++ trunk/tests/phpunit/tests/date.php  2014-09-29 16:19:53 UTC (rev 29794)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,577 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * Tests for public methods of WP_Date_Query.
- *
- * See query/dateQuery.php for tests that require WP_Query.
- *
- * @group datequery
- * @group date
- */
-class Tests_WP_Date_Query extends WP_UnitTestCase {
-       public function test_construct_date_query_empty() {
-               $q = new WP_Date_Query( array() );
-               $this->assertSame( 'AND', $q->relation );
-               $this->assertSame( 'post_date', $q->column );
-               $this->assertSame( '=', $q->compare );
-               $this->assertSame( array(), $q->queries );
-       }
-
-       public function test_construct_date_query_non_array() {
-               $q = new WP_Date_Query( 'foo' );
-               $this->assertSame( 'AND', $q->relation );
-               $this->assertSame( 'post_date', $q->column );
-               $this->assertSame( '=', $q->compare );
-               $this->assertSame( array(), $q->queries );
-       }
-
-       public function test_construct_relation_or_lowercase() {
-               $q = new WP_Date_Query( array(
-                       'relation' => 'or',
-               ) );
-
-               $this->assertSame( 'OR', $q->relation );
-       }
-
-       public function test_construct_relation_invalid() {
-               $q = new WP_Date_Query( array(
-                       'relation' => 'foo',
-               ) );
-
-               $this->assertSame( 'AND', $q->relation );
-       }
-
-       public function test_construct_query_not_an_array_of_arrays() {
-               $q = new WP_Date_Query( array(
-                       'before' => array(
-                               'year' => 2008,
-                               'month' => 6,
-                       ),
-               ) );
-
-               $expected = array(
-                       0 => array(
-                               'before' => array(
-                                       'year' => 2008,
-                                       'month' => 6,
-                               ),
-                       ),
-               );
-
-               $this->assertSame( $expected, $q->queries );
-       }
-
-       public function test_construct_query_contains_non_arrays() {
-               $q = new WP_Date_Query( array(
-                       'foo',
-                       'bar',
-                       array(
-                               'before' => array(
-                                       'year' => 2008,
-                                       'month' => 6,
-                               ),
-                       ),
-               ) );
-
-               // Note: WP_Date_Query does not reset indexes
-               $expected = array(
-                       2 => array(
-                               'before' => array(
-                                       'year' => 2008,
-                                       'month' => 6,
-                               ),
-                       ),
-               );
-
-               $this->assertSame( $expected, $q->queries );
-       }
-
-       public function test_get_compare_empty() {
-               $q = new WP_Date_Query( array() );
-               $this->assertSame( '=', $q->get_compare( array() ) );
-       }
-
-       public function test_get_compare_equals() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '=',
-               ) );
-               $this->assertSame( '=', $found );
-       }
-
-       public function test_get_compare_not_equals() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '!=',
-               ) );
-               $this->assertSame( '!=', $found );
-       }
-
-       public function test_get_compare_greater_than() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '>',
-               ) );
-               $this->assertSame( '>', $found );
-       }
-
-       public function test_get_compare_greater_than_or_equal_to() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '>=',
-               ) );
-               $this->assertSame( '>=', $found );
-       }
-
-       public function test_get_compare_less_than() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '<',
-               ) );
-               $this->assertSame( '<', $found );
-       }
-
-       public function test_get_compare_less_than_or_equal_to() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => '<=',
-               ) );
-               $this->assertSame( '<=', $found );
-       }
-
-       public function test_get_compare_in() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => 'IN',
-               ) );
-               $this->assertSame( 'IN', $found );
-       }
-
-       public function test_get_compare_not_in() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => 'NOT IN',
-               ) );
-               $this->assertSame( 'NOT IN', $found );
-       }
-
-       public function test_get_compare_between() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => 'BETWEEN',
-               ) );
-               $this->assertSame( 'BETWEEN', $found );
-       }
-
-       public function test_get_compare_not_between() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->get_compare( array(
-                       'compare' => 'BETWEEN',
-               ) );
-               $this->assertSame( 'BETWEEN', $found );
-       }
-
-       public function test_validate_column_post_date() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'post_date', $q->validate_column( 'post_date' ) );
-       }
-
-       public function test_validate_column_post_date_gmt() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'post_date_gmt', $q->validate_column( 'post_date_gmt' ) );
-       }
-
-       public function test_validate_column_post_modified() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'post_modified', $q->validate_column( 'post_modified' ) );
-       }
-
-       public function test_validate_column_post_modified_gmt() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) );
-       }
-
-       public function test_validate_column_comment_date() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'comment_date', $q->validate_column( 'comment_date' ) );
-       }
-
-       public function test_validate_column_comment_date_gmt() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) );
-       }
-
-       public function test_validate_column_invalid() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertSame( 'post_date', $q->validate_column( 'foo' ) );
-       }
-
-       public function test_build_value_value_null() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertFalse( $q->build_value( 'foo', null ) );
-       }
-
-       public function test_build_value_compare_in() {
-               $q = new WP_Date_Query( array() );
-
-               // Single integer
-               $found = $q->build_value( 'IN', 4 );
-               $this->assertSame( '(4)', $found );
-
-               // Single non-integer
-               $found = $q->build_value( 'IN', 'foo' );
-               $this->assertSame( '(0)', $found );
-
-               // Array of integers
-               $found = $q->build_value( 'IN', array( 1, 4, 7 ) );
-               $this->assertSame( '(1,4,7)', $found );
-
-               // Array containing non-integers
-               $found = $q->build_value( 'IN', array( 1, 'foo', 7 ) );
-               $this->assertSame( '(1,0,7)', $found );
-       }
-
-       public function test_build_value_compare_not_in() {
-               $q = new WP_Date_Query( array() );
-
-               // Single integer
-               $found = $q->build_value( 'NOT IN', 4 );
-               $this->assertSame( '(4)', $found );
-
-               // Single non-integer
-               $found = $q->build_value( 'NOT IN', 'foo' );
-               $this->assertSame( '(0)', $found );
-
-               // Array of integers
-               $found = $q->build_value( 'NOT IN', array( 1, 4, 7 ) );
-               $this->assertSame( '(1,4,7)', $found );
-
-               // Array containing non-integers
-               $found = $q->build_value( 'NOT IN', array( 1, 'foo', 7 ) );
-               $this->assertSame( '(1,0,7)', $found );
-       }
-
-       public function test_build_value_compare_between_single_integer() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', 4 );
-               $this->assertSame( '4 AND 4', $found );
-       }
-
-       /**
-        * @todo This is a bug. Should return false when non-numeric
-        */
-       public function test_build_value_compare_between_single_non_numeric() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', 'foo' );
-               $this->assertSame( '0 AND 0', $found );
-       }
-
-       /**
-        * @todo This is a bug
-        */
-       public function test_build_value_compare_between_array_with_other_than_two_items() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', array( 2, 3, 4 ) );
-
-               // array_map( 'intval', array(
-               //     array( 2, 3, 4 ),
-               //     array( 2, 3, 4 ),
-               // ) );
-               $this->assertSame( '1 AND 1', $found );
-       }
-
-       /**
-        * @todo This is a bug
-        */
-       public function test_build_value_compare_between_incorrect_array_key() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', array(
-                       2 => 4,
-                       3 => 5,
-               ) );
-
-               // array_map( 'intval', array(
-               //     array( 2 => 4, 3 => 5 ),
-               //     array( 2 => 4, 3 => 5 ),
-               // ) );
-               $this->assertSame( '1 AND 1', $found );
-       }
-
-       public function test_build_value_compare_between_array_contains_non_numeric() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', array( 2, 'foo' ) );
-               $this->assertSame( '2 AND 0', $found );
-       }
-
-       public function test_build_value_compare_between() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'BETWEEN', array( 2, 3 ) );
-               $this->assertSame( '2 AND 3', $found );
-       }
-
-       public function test_build_value_compare_not_between_single_integer() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', 4 );
-               $this->assertSame( '4 AND 4', $found );
-       }
-
-       public function test_build_value_compare_not_between_single_non_numeric() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', 'foo' );
-               $this->assertSame( '0 AND 0', $found );
-       }
-
-       /**
-        * @todo This is a bug
-        */
-       public function test_build_value_compare_not_between_array_with_other_than_two_items() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', array( 2, 3, 4 ) );
-
-               // array_map( 'intval', array(
-               //     array( 2, 3, 4 ),
-               //     array( 2, 3, 4 ),
-               // ) );
-               $this->assertSame( '1 AND 1', $found );
-       }
-
-       /**
-        * @todo This is a bug
-        */
-       public function test_build_value_compare_not_between_incorrect_array_key() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', array(
-                       2 => 4,
-                       3 => 5,
-               ) );
-
-               // array_map( 'intval', array(
-               //     array( 2 => 4, 3 => 5 ),
-               //     array( 2 => 4, 3 => 5 ),
-               // ) );
-               $this->assertSame( '1 AND 1', $found );
-       }
-
-       public function test_build_value_compare_not_between_array_contains_non_numeric() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', array( 2, 'foo' ) );
-               $this->assertSame( '2 AND 0', $found );
-       }
-
-       public function test_build_value_compare_not_between() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'NOT BETWEEN', array( 2, 3 ) );
-               $this->assertSame( '2 AND 3', $found );
-       }
-
-       public function test_build_value_compare_default_value_integer() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'foo', 5 );
-               $this->assertSame( 5, $found );
-       }
-
-       /**
-        * @todo This is probably a bug - ought to return false
-        */
-       public function test_build_value_compare_default_value_non_numeric() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_value( 'foo', 'foo' );
-               $this->assertSame( 0, $found );
-       }
-
-       public function test_build_mysql_datetime_datetime_non_array() {
-               $q = new WP_Date_Query( array() );
-
-               // This might be a fragile test if it takes longer than 1 second to run
-               $found = $q->build_mysql_datetime( 'foo' );
-               $expected = gmdate( 'Y-m-d H:i:s', strtotime( current_time( 'timestamp' ) ) );
-               $this->assertSame( $found, $expected );
-       }
-
-       public function test_build_mysql_datetime_default_to_max_true() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_mysql_datetime( array(
-                       'year' => 2011,
-               ), true );
-               $this->assertSame( '2011-12-31 23:59:59', $found );
-       }
-
-       public function test_build_mysql_datetime_default_to_max_false() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_mysql_datetime( array(
-                       'year' => 2011,
-               ), false );
-               $this->assertSame( '2011-01-01 00:00:00', $found );
-       }
-
-       public function test_build_mysql_datetime_default_to_max_default_to_false() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_mysql_datetime( array(
-                       'year' => 2011,
-               ), false );
-               $this->assertSame( '2011-01-01 00:00:00', $found );
-       }
-
-       public function test_build_time_query_insufficient_time_values() {
-               $q = new WP_Date_Query( array() );
-
-               $this->assertFalse( $q->build_time_query( 'post_date', '=' ) );
-       }
-
-       public function test_build_time_query_compare_in() {
-               $q = new WP_Date_Query( array() );
-
-               // Just hour
-               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ) );
-               $this->assertSame( 'HOUR( post_date ) IN (1,2)', $found );
-
-               // Skip minute
-               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), null, 6 );
-               $this->assertSame( 'HOUR( post_date ) IN (1,2) AND SECOND( post_date ) IN (6)', $found );
-
-               // All three
-               $found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
-               $this->assertSame( 'HOUR( post_date ) IN (1,2) AND MINUTE( post_date ) IN (3,4,5) AND SECOND( post_date ) IN (6)', $found );
-       }
-
-       public function test_build_time_query_compare_not_in() {
-               $q = new WP_Date_Query( array() );
-
-               // Just hour
-               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ) );
-               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2)', $found );
-
-               // Skip minute
-               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), null, 6 );
-               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND SECOND( post_date ) NOT IN (6)', $found );
-
-               // All three
-               $found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
-               $this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND MINUTE( post_date ) NOT IN (3,4,5) AND SECOND( post_date ) NOT IN (6)', $found );
-       }
-
-       public function test_build_time_query_compare_between() {
-               $q = new WP_Date_Query( array() );
-
-               // Just hour
-               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ) );
-               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2', $found );
-
-               // Skip minute
-               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
-               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
-
-               // All three
-               $found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
-               $this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND MINUTE( post_date ) BETWEEN 3 AND 4 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
-       }
-
-       public function test_build_time_query_compare_not_between() {
-               $q = new WP_Date_Query( array() );
-
-               // Just hour
-               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ) );
-               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2', $found );
-
-               // Skip minute
-               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
-               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
-
-               // All three
-               $found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
-               $this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND MINUTE( post_date ) NOT BETWEEN 3 AND 4 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
-       }
-
-       public function test_build_time_query_hour_only() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', 5 );
-               $this->assertSame( 'HOUR( post_date ) = 5', $found );
-       }
-
-       public function test_build_time_query_minute_only() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', null, 5 );
-               $this->assertSame( 'MINUTE( post_date ) = 5', $found );
-       }
-
-       public function test_build_time_query_second_only() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', null, null, 5 );
-               $this->assertSame( 'SECOND( post_date ) = 5', $found );
-       }
-
-       public function test_build_time_query_hour_and_second() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', 5, null, 5 );
-               $this->assertFalse( $found );
-       }
-
-       public function test_build_time_query_hour_minute() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', 5, 15 );
-
-               // $compare value is floating point - use regex to account for
-               // varying precision on different PHP installations
-               $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $found );
-       }
-
-       public function test_build_time_query_hour_minute_second() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', 5, 15, 35 );
-
-               // $compare value is floating point - use regex to account for
-               // varying precision on different PHP installations
-               $this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $found );
-       }
-
-       public function test_build_time_query_minute_second() {
-               $q = new WP_Date_Query( array() );
-
-               $found = $q->build_time_query( 'post_date', '=', null, 15, 35 );
-
-               // $compare value is floating point - use regex to account for
-               // varying precision on different PHP installations
-               $this->assertRegExp( "/DATE_FORMAT\( post_date, '0\.%i%s' \) = 0\.15350*/", $found );
-       }
-}
</del></span></pre>
</div>
</div>

</body>
</html>