<!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>[26056] trunk/tests/phpunit/tests/post/query.php: Fix inexcusable whitespace in `tests/phpunit/tests/post/query.php`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { 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">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26056">26056</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2013-11-08 23:13:41 +0000 (Fri, 08 Nov 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix inexcusable whitespace in `tests/phpunit/tests/post/query.php`.
Props wonderboymusic.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestspostqueryphp">trunk/tests/phpunit/tests/post/query.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestspostqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/post/query.php (26055 => 26056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/post/query.php 2013-11-08 23:10:41 UTC (rev 26055)
+++ trunk/tests/phpunit/tests/post/query.php 2013-11-08 23:13:41 UTC (rev 26056)
</span><span class="lines">@@ -4,201 +4,201 @@
</span><span class="cx"> * @group meta
</span><span class="cx"> */
</span><span class="cx"> class Tests_Post_Query extends WP_UnitTestCase {
</span><del>- function setUp() {
- parent::setUp();
- }
</del><ins>+ function setUp() {
+ parent::setUp();
+ }
</ins><span class="cx">
</span><del>- function test_meta_key_or_query() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'foo', rand_str() );
- add_post_meta( $post_id, 'foo', rand_str() );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'bar', 'val2' );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'baz', rand_str() );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'froo', rand_str() );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'tango', 'val2' );
- $post_id6 = $this->factory->post->create();
- add_post_meta( $post_id6, 'bar', 'val1' );
</del><ins>+ function test_meta_key_or_query() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'foo', rand_str() );
+ add_post_meta( $post_id, 'foo', rand_str() );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'bar', 'val2' );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'baz', rand_str() );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'froo', rand_str() );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'tango', 'val2' );
+ $post_id6 = $this->factory->post->create();
+ add_post_meta( $post_id6, 'bar', 'val1' );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo'
- ),
- array(
- 'key' => 'bar',
- 'value' => 'val2'
- ),
- array(
- 'key' => 'baz'
- ),
- array(
- 'key' => 'froo'
- ),
- 'relation' => 'OR',
- ),
- ) );
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo'
+ ),
+ array(
+ 'key' => 'bar',
+ 'value' => 'val2'
+ ),
+ array(
+ 'key' => 'baz'
+ ),
+ array(
+ 'key' => 'froo'
+ ),
+ 'relation' => 'OR',
+ ),
+ ) );
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 4, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 4, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+
+ $post_ids = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id2, $post_id3, $post_id4 ), $post_ids );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- $post_ids = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id2, $post_id3, $post_id4 ), $post_ids );
- }
</del><ins>+ function test_meta_key_and_query() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'foo', rand_str() );
+ add_post_meta( $post_id, 'foo', rand_str() );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'bar', 'val2' );
+ add_post_meta( $post_id2, 'foo', rand_str() );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'baz', rand_str() );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'froo', rand_str() );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'tango', 'val2' );
+ $post_id6 = $this->factory->post->create();
+ add_post_meta( $post_id6, 'bar', 'val1' );
+ add_post_meta( $post_id6, 'foo', rand_str() );
+ $post_id7 = $this->factory->post->create();
+ add_post_meta( $post_id7, 'foo', rand_str() );
+ add_post_meta( $post_id7, 'froo', rand_str() );
+ add_post_meta( $post_id7, 'baz', rand_str() );
+ add_post_meta( $post_id7, 'bar', 'val2' );
</ins><span class="cx">
</span><del>- function test_meta_key_and_query() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'foo', rand_str() );
- add_post_meta( $post_id, 'foo', rand_str() );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'bar', 'val2' );
- add_post_meta( $post_id2, 'foo', rand_str() );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'baz', rand_str() );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'froo', rand_str() );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'tango', 'val2' );
- $post_id6 = $this->factory->post->create();
- add_post_meta( $post_id6, 'bar', 'val1' );
- add_post_meta( $post_id6, 'foo', rand_str() );
- $post_id7 = $this->factory->post->create();
- add_post_meta( $post_id7, 'foo', rand_str() );
- add_post_meta( $post_id7, 'froo', rand_str() );
- add_post_meta( $post_id7, 'baz', rand_str() );
- add_post_meta( $post_id7, 'bar', 'val2' );
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo'
+ ),
+ array(
+ 'key' => 'bar',
+ 'value' => 'val2'
+ ),
+ array(
+ 'key' => 'baz'
+ ),
+ array(
+ 'key' => 'froo'
+ ),
+ 'relation' => 'AND',
+ ),
+ ) );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo'
- ),
- array(
- 'key' => 'bar',
- 'value' => 'val2'
- ),
- array(
- 'key' => 'baz'
- ),
- array(
- 'key' => 'froo'
- ),
- 'relation' => 'AND',
- ),
- ) );
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 1, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 1, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
</del><ins>+ $post_ids = wp_list_pluck( $posts, 'ID' );
+ $this->assertEquals( array( $post_id7 ), $post_ids );
</ins><span class="cx">
</span><del>- $post_ids = wp_list_pluck( $posts, 'ID' );
- $this->assertEquals( array( $post_id7 ), $post_ids );
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo'
+ ),
+ array(
+ 'key' => 'bar',
+ ),
+ 'relation' => 'AND',
+ ),
+ ) );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo'
- ),
- array(
- 'key' => 'bar',
- ),
- 'relation' => 'AND',
- ),
- ) );
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 3, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 3, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $post_ids = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id2, $post_id6, $post_id7 ), $post_ids );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- $post_ids = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id2, $post_id6, $post_id7 ), $post_ids );
- }
</del><ins>+ /**
+ * @ticket 18158
+ */
+ function test_meta_key_not_exists() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'foo', rand_str() );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'bar', rand_str() );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'bar', rand_str() );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'baz', rand_str() );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'foo', rand_str() );
</ins><span class="cx">
</span><del>- /**
- * @ticket 18158
- */
- function test_meta_key_not_exists() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'foo', rand_str() );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'bar', rand_str() );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'bar', rand_str() );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'baz', rand_str() );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'foo', rand_str() );
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo',
+ 'compare' => 'NOT EXISTS',
+ ),
+ ),
+ ) );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo',
- 'compare' => 'NOT EXISTS',
- ),
- ),
- ) );
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 3, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 3, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo',
+ 'compare' => 'NOT EXISTS',
+ ),
+ array(
+ 'key' => 'bar',
+ 'compare' => 'NOT EXISTS',
+ ),
+ ),
+ ) );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo',
- 'compare' => 'NOT EXISTS',
- ),
- array(
- 'key' => 'bar',
- 'compare' => 'NOT EXISTS',
- ),
- ),
- ) );
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 1, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 1, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $query = new WP_Query( array(
+ 'meta_query' => array(
+ array(
+ 'key' => 'foo',
+ 'compare' => 'NOT EXISTS',
+ ),
+ array(
+ 'key' => 'bar',
+ 'compare' => 'NOT EXISTS',
+ ),
+ array(
+ 'key' => 'baz',
+ 'compare' => 'NOT EXISTS',
+ ),
+ )
+ ) );
+
+ $posts = $query->get_posts();
+ $this->assertEquals( 0, count( $posts ) );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'meta_query' => array(
- array(
- 'key' => 'foo',
- 'compare' => 'NOT EXISTS',
- ),
- array(
- 'key' => 'bar',
- 'compare' => 'NOT EXISTS',
- ),
- array(
- 'key' => 'baz',
- 'compare' => 'NOT EXISTS',
- ),
- )
- ) );
-
- $posts = $query->get_posts();
- $this->assertEquals( 0, count( $posts ) );
- }
-
</del><span class="cx"> /**
</span><span class="cx"> * @ticket 23033
</span><span class="cx"> */
</span><span class="lines">@@ -332,216 +332,216 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>- /**
- * @ticket 20604
- */
- function test_taxonomy_empty_or() {
- // An empty tax query should return an empty array, not all posts.
</del><ins>+ /**
+ * @ticket 20604
+ */
+ function test_taxonomy_empty_or() {
+ // An empty tax query should return an empty array, not all posts.
</ins><span class="cx">
</span><del>- $this->factory->post->create_many( 10 );
</del><ins>+ $this->factory->post->create_many( 10 );
</ins><span class="cx">
</span><del>- $query = new WP_Query( array(
- 'fields' => 'ids',
- 'tax_query' => array(
- 'relation' => 'OR',
- array(
- 'taxonomy' => 'post_tag',
- 'field' => 'id',
- 'terms' => false,
- 'operator' => 'IN'
- ),
- array(
- 'taxonomy' => 'category',
- 'field' => 'id',
- 'terms' => false,
- 'operator' => 'IN'
- )
- )
- ) );
</del><ins>+ $query = new WP_Query( array(
+ 'fields' => 'ids',
+ 'tax_query' => array(
+ 'relation' => 'OR',
+ array(
+ 'taxonomy' => 'post_tag',
+ 'field' => 'id',
+ 'terms' => false,
+ 'operator' => 'IN'
+ ),
+ array(
+ 'taxonomy' => 'category',
+ 'field' => 'id',
+ 'terms' => false,
+ 'operator' => 'IN'
+ )
+ )
+ ) );
</ins><span class="cx">
</span><del>- $posts = $query->get_posts();
- $this->assertEquals( 0 , count( $posts ) );
- }
</del><ins>+ $posts = $query->get_posts();
+ $this->assertEquals( 0 , count( $posts ) );
+ }
</ins><span class="cx">
</span><del>- function test_meta_between_not_between() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'time', 500 );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'time', 1001 );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'time', 0 );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'time', 1 );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'time', 1000 );
</del><ins>+ function test_meta_between_not_between() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'time', 500 );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'time', 1001 );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'time', 0 );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'time', 1 );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'time', 1000 );
</ins><span class="cx">
</span><del>- $args = array(
- 'meta_key' => 'time',
- 'meta_value' => array( 1, 1000 ),
- 'meta_type' => 'numeric',
- 'meta_compare' => 'NOT BETWEEN'
- );
</del><ins>+ $args = array(
+ 'meta_key' => 'time',
+ 'meta_value' => array( 1, 1000 ),
+ 'meta_type' => 'numeric',
+ 'meta_compare' => 'NOT BETWEEN'
+ );
</ins><span class="cx">
</span><del>- $query = new WP_Query( $args );
- $this->assertEquals( 2, count ( $query->posts ) );
- foreach ( $query->posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
- $posts = wp_list_pluck( $query->posts, 'ID' );
- $this->assertEqualSets( array( $post_id2, $post_id3 ), $posts );
</del><ins>+ $query = new WP_Query( $args );
+ $this->assertEquals( 2, count ( $query->posts ) );
+ foreach ( $query->posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $query->posts, 'ID' );
+ $this->assertEqualSets( array( $post_id2, $post_id3 ), $posts );
</ins><span class="cx">
</span><del>- $args = array(
- 'meta_key' => 'time',
- 'meta_value' => array( 1, 1000 ),
- 'meta_type' => 'numeric',
- 'meta_compare' => 'BETWEEN'
- );
</del><ins>+ $args = array(
+ 'meta_key' => 'time',
+ 'meta_value' => array( 1, 1000 ),
+ 'meta_type' => 'numeric',
+ 'meta_compare' => 'BETWEEN'
+ );
</ins><span class="cx">
</span><del>- $query = new WP_Query( $args );
- $this->assertEquals( 3, count ( $query->posts ) );
- foreach ( $query->posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $query = new WP_Query( $args );
+ $this->assertEquals( 3, count ( $query->posts ) );
+ foreach ( $query->posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $query->posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id4, $post_id5 ), $posts );
</ins><span class="cx"> }
</span><del>- $posts = wp_list_pluck( $query->posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id4, $post_id5 ), $posts );
- }
</del><span class="cx">
</span><del>- /**
- * @ticket 16829
- */
- function test_meta_default_compare() {
- // compare should default to IN when meta_value is an array
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'foo', 'bar' );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'bar', 'baz' );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'foo', 'baz' );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'baz', 'bar' );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'foo', rand_str() );
</del><ins>+ /**
+ * @ticket 16829
+ */
+ function test_meta_default_compare() {
+ // compare should default to IN when meta_value is an array
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'foo', 'bar' );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'bar', 'baz' );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'foo', 'baz' );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'baz', 'bar' );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'foo', rand_str() );
</ins><span class="cx">
</span><del>- $posts = get_posts( array(
- 'meta_key' => 'foo',
- 'meta_value' => array( 'bar', 'baz' )
- ) );
</del><ins>+ $posts = get_posts( array(
+ 'meta_key' => 'foo',
+ 'meta_value' => array( 'bar', 'baz' )
+ ) );
</ins><span class="cx">
</span><del>- $this->assertEquals( 2, count( $posts ) );
- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
</del><ins>+ $this->assertEquals( 2, count( $posts ) );
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
</ins><span class="cx">
</span><del>- $posts = get_posts( array(
- 'meta_key' => 'foo',
- 'meta_value' => array( 'bar', 'baz' ),
- 'meta_compare' => 'IN'
- ) );
</del><ins>+ $posts = get_posts( array(
+ 'meta_key' => 'foo',
+ 'meta_value' => array( 'bar', 'baz' ),
+ 'meta_compare' => 'IN'
+ ) );
</ins><span class="cx">
</span><del>- $this->assertEquals( 2, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $this->assertEquals( 2, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
</ins><span class="cx"> }
</span><del>- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
- }
</del><span class="cx">
</span><del>- /**
- * @ticket 17264
- */
- function test_duplicate_posts_when_no_key() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'city', 'Lorem' );
- add_post_meta( $post_id, 'address', '123 Lorem St.' );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'city', 'Lorem' );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'city', 'Loren' );
</del><ins>+ /**
+ * @ticket 17264
+ */
+ function test_duplicate_posts_when_no_key() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'city', 'Lorem' );
+ add_post_meta( $post_id, 'address', '123 Lorem St.' );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'city', 'Lorem' );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'city', 'Loren' );
</ins><span class="cx">
</span><del>- $args = array(
- 'meta_query' => array(
- array(
- 'value' => 'lorem',
- 'compare' => 'LIKE'
- )
- )
- );
</del><ins>+ $args = array(
+ 'meta_query' => array(
+ array(
+ 'value' => 'lorem',
+ 'compare' => 'LIKE'
+ )
+ )
+ );
</ins><span class="cx">
</span><del>- $posts = get_posts( $args );
- $this->assertEquals( 2, count( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $posts = get_posts( $args );
+ $this->assertEquals( 2, count( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id2 ), $posts );
</ins><span class="cx"> }
</span><del>- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id2 ), $posts );
- }
</del><span class="cx">
</span><del>- /**
- * @ticket 15292
- */
- function test_empty_meta_value() {
- $post_id = $this->factory->post->create();
- add_post_meta( $post_id, 'foo', '0' );
- add_post_meta( $post_id, 'bar', 0 );
- $post_id2 = $this->factory->post->create();
- add_post_meta( $post_id2, 'foo', 1 );
- $post_id3 = $this->factory->post->create();
- add_post_meta( $post_id3, 'baz', 0 );
- $post_id4 = $this->factory->post->create();
- add_post_meta( $post_id4, 'baz', 0 );
- $post_id5 = $this->factory->post->create();
- add_post_meta( $post_id5, 'baz', 0 );
- add_post_meta( $post_id5, 'bar', '0' );
- $post_id6 = $this->factory->post->create();
- add_post_meta( $post_id6, 'baz', 0 );
</del><ins>+ /**
+ * @ticket 15292
+ */
+ function test_empty_meta_value() {
+ $post_id = $this->factory->post->create();
+ add_post_meta( $post_id, 'foo', '0' );
+ add_post_meta( $post_id, 'bar', 0 );
+ $post_id2 = $this->factory->post->create();
+ add_post_meta( $post_id2, 'foo', 1 );
+ $post_id3 = $this->factory->post->create();
+ add_post_meta( $post_id3, 'baz', 0 );
+ $post_id4 = $this->factory->post->create();
+ add_post_meta( $post_id4, 'baz', 0 );
+ $post_id5 = $this->factory->post->create();
+ add_post_meta( $post_id5, 'baz', 0 );
+ add_post_meta( $post_id5, 'bar', '0' );
+ $post_id6 = $this->factory->post->create();
+ add_post_meta( $post_id6, 'baz', 0 );
</ins><span class="cx">
</span><del>- $posts = get_posts( array( 'meta_key' => 'foo', 'meta_value' => '0' ) );
- $this->assertEquals( 1, count ( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
- $this->assertEquals( $post_id, $posts[0]->ID );
</del><ins>+ $posts = get_posts( array( 'meta_key' => 'foo', 'meta_value' => '0' ) );
+ $this->assertEquals( 1, count ( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $this->assertEquals( $post_id, $posts[0]->ID );
</ins><span class="cx">
</span><del>- $posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => '0' ) );
- $this->assertEquals( 2, count ( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
</del><ins>+ $posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => '0' ) );
+ $this->assertEquals( 2, count ( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
</ins><span class="cx">
</span><del>- $posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => 0 ) );
- $this->assertEquals( 2, count ( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
</del><ins>+ $posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => 0 ) );
+ $this->assertEquals( 2, count ( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
</ins><span class="cx">
</span><del>- $posts = get_posts( array( 'meta_value' => 0 ) );
- $this->assertEquals( 5, count ( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
- }
- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
</del><ins>+ $posts = get_posts( array( 'meta_value' => 0 ) );
+ $this->assertEquals( 5, count ( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
</ins><span class="cx">
</span><del>- $posts = get_posts( array( 'meta_value' => '0' ) );
- $this->assertEquals( 5, count ( $posts ) );
- foreach ( $posts as $post ) {
- $this->assertInstanceOf( 'WP_Post', $post );
- $this->assertEquals( 'raw', $post->filter );
</del><ins>+ $posts = get_posts( array( 'meta_value' => '0' ) );
+ $this->assertEquals( 5, count ( $posts ) );
+ foreach ( $posts as $post ) {
+ $this->assertInstanceOf( 'WP_Post', $post );
+ $this->assertEquals( 'raw', $post->filter );
+ }
+ $posts = wp_list_pluck( $posts, 'ID' );
+ $this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
</ins><span class="cx"> }
</span><del>- $posts = wp_list_pluck( $posts, 'ID' );
- $this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
- }
</del><span class="cx">
</span><span class="cx"> function test_taxonomy_include_children() {
</span><span class="cx"> $cat_a = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) );
</span><span class="lines">@@ -555,76 +555,76 @@
</span><span class="cx"> $post_d = $this->factory->post->create( array( 'post_category' => array( $cat_d ) ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_a ),
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 4 , count( $posts ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_a ),
</span><span class="cx"> 'include_children' => false
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 1 , count( $posts ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_b ),
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 3 , count( $posts ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_b ),
</span><span class="cx"> 'include_children' => false
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 1 , count( $posts ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_c ),
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 1 , count( $posts ) );
</span><span class="cx">
</span><span class="cx"> $posts = get_posts( array(
</span><del>- 'tax_query' => array(
</del><ins>+ 'tax_query' => array(
</ins><span class="cx"> array(
</span><span class="cx"> 'taxonomy' => 'category',
</span><span class="cx"> 'field' => 'id',
</span><span class="cx"> 'terms' => array( $cat_c ),
</span><span class="cx"> 'include_children' => false
</span><span class="cx"> )
</span><del>- )
</del><ins>+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 1 , count( $posts ) );
</span><span class="lines">@@ -677,4 +677,4 @@
</span><span class="cx">
</span><span class="cx"> return $posts;
</span><span class="cx"> }
</span><del>-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>