| @@ 351-369 (lines=19) @@ | ||
| 348 | /** |
|
| 349 | * @ticket 29801 |
|
| 350 | */ |
|
| 351 | public function test_build_value_compare_in() |
|
| 352 | { |
|
| 353 | $q = new WP_Date_Query(array()); |
|
| 354 | ||
| 355 | // Single integer |
|
| 356 | $found = $q->build_value('IN', 4); |
|
| 357 | $this->assertSame('(4)', $found); |
|
| 358 | ||
| 359 | // Single non-integer |
|
| 360 | $found = $q->build_value('IN', 'foo'); |
|
| 361 | $this->assertFalse($found); |
|
| 362 | ||
| 363 | // Array of integers |
|
| 364 | $found = $q->build_value('IN', array( 1, 4, 7 )); |
|
| 365 | $this->assertSame('(1,4,7)', $found); |
|
| 366 | ||
| 367 | // Array containing non-integers |
|
| 368 | $found = $q->build_value('IN', array( 1, 'foo', 7 )); |
|
| 369 | $this->assertSame('(1,7)', $found); |
|
| 370 | } |
|
| 371 | ||
| 372 | /** |
|
| @@ 375-393 (lines=19) @@ | ||
| 372 | /** |
|
| 373 | * @ticket 29801 |
|
| 374 | */ |
|
| 375 | public function test_build_value_compare_not_in() |
|
| 376 | { |
|
| 377 | $q = new WP_Date_Query(array()); |
|
| 378 | ||
| 379 | // Single integer |
|
| 380 | $found = $q->build_value('NOT IN', 4); |
|
| 381 | $this->assertSame('(4)', $found); |
|
| 382 | ||
| 383 | // Single non-integer |
|
| 384 | $found = $q->build_value('NOT IN', 'foo'); |
|
| 385 | $this->assertFalse($found); |
|
| 386 | ||
| 387 | // Array of integers |
|
| 388 | $found = $q->build_value('NOT IN', array( 1, 4, 7 )); |
|
| 389 | $this->assertSame('(1,4,7)', $found); |
|
| 390 | ||
| 391 | // Array containing non-integers |
|
| 392 | $found = $q->build_value('NOT IN', array( 1, 'foo', 7 )); |
|
| 393 | $this->assertSame('(1,7)', $found); |
|
| 394 | } |
|
| 395 | ||
| 396 | public function test_build_value_compare_between_single_integer() |
|