Changeset 31340 for trunk/tests/phpunit/tests/query/metaQuery.php
- Timestamp:
- 02/05/2015 07:37:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/metaQuery.php
r31312 r31340 1563 1563 * @ticket 31045 1564 1564 */ 1565 public function test_orderby_ name() {1565 public function test_orderby_clause_key() { 1566 1566 $posts = $this->factory->post->create_many( 3 ); 1567 1567 add_post_meta( $posts[0], 'foo', 'aaa' ); … … 1572 1572 'fields' => 'ids', 1573 1573 'meta_query' => array( 1574 array( 1575 'name' => 'foo_name', 1574 'foo_key' => array( 1576 1575 'key' => 'foo', 1577 1576 'compare' => 'EXISTS', 1578 1577 ), 1579 1578 ), 1580 'orderby' => 'foo_ name',1579 'orderby' => 'foo_key', 1581 1580 'order' => 'DESC', 1582 1581 ) ); … … 1588 1587 * @ticket 31045 1589 1588 */ 1590 public function test_orderby_ name_as_secondary_sort() {1589 public function test_orderby_clause_key_as_secondary_sort() { 1591 1590 $p1 = $this->factory->post->create( array( 1592 1591 'post_date' => '2015-01-28 03:00:00', … … 1606 1605 'fields' => 'ids', 1607 1606 'meta_query' => array( 1608 array( 1609 'name' => 'foo_name', 1607 'foo_key' => array( 1610 1608 'key' => 'foo', 1611 1609 'compare' => 'EXISTS', … … 1614 1612 'orderby' => array( 1615 1613 'post_date' => 'asc', 1616 'foo_ name' => 'asc',1614 'foo_key' => 'asc', 1617 1615 ), 1618 1616 ) ); … … 1624 1622 * @ticket 31045 1625 1623 */ 1626 public function test_orderby_more_than_one_ name() {1624 public function test_orderby_more_than_one_clause_key() { 1627 1625 $posts = $this->factory->post->create_many( 3 ); 1628 1626 … … 1637 1635 'fields' => 'ids', 1638 1636 'meta_query' => array( 1639 array( 1640 'name' => 'foo_name', 1637 'foo_key' => array( 1641 1638 'key' => 'foo', 1642 1639 'compare' => 'EXISTS', 1643 1640 ), 1644 array( 1645 'name' => 'bar_name', 1641 'bar_key' => array( 1646 1642 'key' => 'bar', 1647 1643 'compare' => 'EXISTS', … … 1649 1645 ), 1650 1646 'orderby' => array( 1651 'foo_ name' => 'asc',1652 'bar_ name' => 'desc',1647 'foo_key' => 'asc', 1648 'bar_key' => 'desc', 1653 1649 ), 1654 1650 ) ); … … 1656 1652 $this->assertEquals( array( $posts[2], $posts[0], $posts[1] ), $q->posts ); 1657 1653 } 1654 1655 /** 1656 * @ticket 31045 1657 */ 1658 public function test_duplicate_clause_keys_should_be_made_unique() { 1659 $q = new WP_Query( array( 1660 'fields' => 'ids', 1661 'meta_query' => array( 1662 'foo_key' => array( 1663 'key' => 'foo', 1664 'compare' => 'EXISTS', 1665 ), 1666 array( 1667 'foo_key' => array( 1668 'key' => 'bar', 1669 'compare' => 'EXISTS', 1670 ), 1671 ), 1672 array( 1673 'foo_key' => array( 1674 'key' => 'baz', 1675 'compare' => 'EXISTS', 1676 ), 1677 ), 1678 ), 1679 ) ); 1680 1681 $this->assertEqualSets( array( 'foo_key', 'foo_key-1', 'foo_key-2' ), array_keys( $q->meta_query->get_clauses() ) ); 1682 } 1658 1683 }
Note: See TracChangeset
for help on using the changeset viewer.