|
@@ 165-180 (lines=16) @@
|
| 162 |
|
* |
| 163 |
|
* @ticket 12668 |
| 164 |
|
*/ |
| 165 |
|
public function test_type_array_comments_and_custom() |
| 166 |
|
{ |
| 167 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 168 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' )); |
| 169 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' )); |
| 170 |
|
$c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 171 |
|
$c5 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' )); |
| 172 |
|
$c6 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 173 |
|
|
| 174 |
|
$q = new WP_Comment_Query(); |
| 175 |
|
$found = $q->query( |
| 176 |
|
array( |
| 177 |
|
'type' => array( 'comments', 'mario' ), |
| 178 |
|
'fields' => 'ids', |
| 179 |
|
) |
| 180 |
|
); |
| 181 |
|
|
| 182 |
|
$this->assertEqualSets(array( $c1, $c4, $c6 ), $found); |
| 183 |
|
} |
|
@@ 188-203 (lines=16) @@
|
| 185 |
|
/** |
| 186 |
|
* @ticket 12668 |
| 187 |
|
*/ |
| 188 |
|
public function test_type_not__in_array_custom() |
| 189 |
|
{ |
| 190 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 191 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' )); |
| 192 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' )); |
| 193 |
|
$c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 194 |
|
$c5 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' )); |
| 195 |
|
$c6 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 196 |
|
|
| 197 |
|
$q = new WP_Comment_Query(); |
| 198 |
|
$found = $q->query( |
| 199 |
|
array( |
| 200 |
|
'type__not_in' => array( 'luigi' ), |
| 201 |
|
'fields' => 'ids', |
| 202 |
|
) |
| 203 |
|
); |
| 204 |
|
|
| 205 |
|
$this->assertEqualSets(array( $c1, $c2, $c3, $c4, $c6 ), $found); |
| 206 |
|
} |
|
@@ 211-227 (lines=17) @@
|
| 208 |
|
/** |
| 209 |
|
* @ticket 12668 |
| 210 |
|
*/ |
| 211 |
|
public function test_type__in_array_and_not_type_array_custom() |
| 212 |
|
{ |
| 213 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 214 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' )); |
| 215 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' )); |
| 216 |
|
$c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 217 |
|
$c5 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' )); |
| 218 |
|
$c6 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 219 |
|
|
| 220 |
|
$q = new WP_Comment_Query(); |
| 221 |
|
$found = $q->query( |
| 222 |
|
array( |
| 223 |
|
'type__in' => array( 'comments' ), |
| 224 |
|
'type__not_in' => array( 'luigi' ), |
| 225 |
|
'fields' => 'ids', |
| 226 |
|
) |
| 227 |
|
); |
| 228 |
|
|
| 229 |
|
$this->assertEqualSets(array( $c1 ), $found); |
| 230 |
|
} |
|
@@ 235-251 (lines=17) @@
|
| 232 |
|
/** |
| 233 |
|
* @ticket 12668 |
| 234 |
|
*/ |
| 235 |
|
public function test_type_array_and_type__not_in_array_custom() |
| 236 |
|
{ |
| 237 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 238 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' )); |
| 239 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' )); |
| 240 |
|
$c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 241 |
|
$c5 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' )); |
| 242 |
|
$c6 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 243 |
|
|
| 244 |
|
$q = new WP_Comment_Query(); |
| 245 |
|
$found = $q->query( |
| 246 |
|
array( |
| 247 |
|
'type' => array( 'pings' ), |
| 248 |
|
'type__not_in' => array( 'mario' ), |
| 249 |
|
'fields' => 'ids', |
| 250 |
|
) |
| 251 |
|
); |
| 252 |
|
|
| 253 |
|
$this->assertEqualSets(array( $c2, $c3 ), $found); |
| 254 |
|
} |
|
@@ 259-274 (lines=16) @@
|
| 256 |
|
/** |
| 257 |
|
* @ticket 12668 |
| 258 |
|
*/ |
| 259 |
|
public function test_type__not_in_custom() |
| 260 |
|
{ |
| 261 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 262 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' )); |
| 263 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' )); |
| 264 |
|
$c4 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 265 |
|
$c5 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' )); |
| 266 |
|
$c6 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' )); |
| 267 |
|
|
| 268 |
|
$q = new WP_Comment_Query(); |
| 269 |
|
$found = $q->query( |
| 270 |
|
array( |
| 271 |
|
'type__not_in' => 'luigi', |
| 272 |
|
'fields' => 'ids', |
| 273 |
|
) |
| 274 |
|
); |
| 275 |
|
|
| 276 |
|
$this->assertEqualSets(array( $c1, $c2, $c3, $c4, $c6 ), $found); |
| 277 |
|
} |