|
@@ 2044-2060 (lines=17) @@
|
| 2041 |
|
/** |
| 2042 |
|
* @ticket 35512 |
| 2043 |
|
*/ |
| 2044 |
|
public function test_post_type_any_should_override_other_post_types() |
| 2045 |
|
{ |
| 2046 |
|
register_post_type('post-type-1', array( 'exclude_from_search' => false )); |
| 2047 |
|
register_post_type('post-type-2', array( 'exclude_from_search' => false )); |
| 2048 |
|
|
| 2049 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'post-type-1' )); |
| 2050 |
|
$p2 = self::factory()->post->create(array( 'post_type' => 'post-type-2' )); |
| 2051 |
|
|
| 2052 |
|
$c1 = self::factory()->comment->create_post_comments($p1, 1); |
| 2053 |
|
$c2 = self::factory()->comment->create_post_comments($p2, 1); |
| 2054 |
|
|
| 2055 |
|
$q = new WP_Comment_Query(); |
| 2056 |
|
$found = $q->query( |
| 2057 |
|
array( |
| 2058 |
|
'fields' => 'ids', |
| 2059 |
|
'post_type' => array( 'any', 'post-type-1' ), |
| 2060 |
|
) |
| 2061 |
|
); |
| 2062 |
|
$this->assertEqualSets(array_merge($c1, $c2), $found); |
| 2063 |
|
} |
|
@@ 2068-2084 (lines=17) @@
|
| 2065 |
|
/** |
| 2066 |
|
* @ticket 35512 |
| 2067 |
|
*/ |
| 2068 |
|
public function test_post_type_any_as_part_of_an_array_of_post_types() |
| 2069 |
|
{ |
| 2070 |
|
register_post_type('post-type-1', array( 'exclude_from_search' => false )); |
| 2071 |
|
register_post_type('post-type-2', array( 'exclude_from_search' => false )); |
| 2072 |
|
|
| 2073 |
|
$p1 = self::factory()->post->create(array( 'post_type' => 'post-type-1' )); |
| 2074 |
|
$p2 = self::factory()->post->create(array( 'post_type' => 'post-type-2' )); |
| 2075 |
|
|
| 2076 |
|
$c1 = self::factory()->comment->create_post_comments($p1, 1); |
| 2077 |
|
$c2 = self::factory()->comment->create_post_comments($p2, 1); |
| 2078 |
|
|
| 2079 |
|
$q = new WP_Comment_Query(); |
| 2080 |
|
$found = $q->query( |
| 2081 |
|
array( |
| 2082 |
|
'fields' => 'ids', |
| 2083 |
|
'post_type' => array( 'any' ), |
| 2084 |
|
) |
| 2085 |
|
); |
| 2086 |
|
$this->assertEqualSets(array_merge($c1, $c2), $found); |
| 2087 |
|
} |