Changeset 51462 for trunk/tests/phpunit/tests/post/query.php
- Timestamp:
- 07/19/2021 02:00:11 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/query.php
r51436 r51462 320 320 321 321 $q1 = new WP_Query( array( 'post_status' => 'any' ) ); 322 $this->assert Contains( "post_status <> 'auto-draft'", $q1->request );322 $this->assertStringContainsString( "post_status <> 'auto-draft'", $q1->request ); 323 323 324 324 $q2 = new WP_Query( array( 'post_status' => 'any, auto-draft' ) ); 325 $this->assert NotContains( "post_status <> 'auto-draft'", $q2->request );325 $this->assertStringNotContainsString( "post_status <> 'auto-draft'", $q2->request ); 326 326 327 327 $q3 = new WP_Query( array( 'post_status' => array( 'any', 'auto-draft' ) ) ); 328 $this->assert NotContains( "post_status <> 'auto-draft'", $q3->request );328 $this->assertStringNotContainsString( "post_status <> 'auto-draft'", $q3->request ); 329 329 } 330 330 … … 343 343 ) 344 344 ); 345 $this->assert Contains(345 $this->assertStringContainsString( 346 346 "ORDER BY $wpdb->posts.post_type DESC, $wpdb->posts.post_name ASC", 347 347 $q1->request … … 349 349 350 350 $q2 = new WP_Query( array( 'orderby' => array() ) ); 351 $this->assert NotContains( 'ORDER BY', $q2->request );352 $this->assert NotContains( 'ORDER', $q2->request );351 $this->assertStringNotContainsString( 'ORDER BY', $q2->request ); 352 $this->assertStringNotContainsString( 'ORDER', $q2->request ); 353 353 354 354 $q3 = new WP_Query( array( 'post_type' => 'post' ) ); 355 $this->assert Contains(355 $this->assertStringContainsString( 356 356 "ORDER BY $wpdb->posts.post_date DESC", 357 357 $q3->request … … 359 359 360 360 $q4 = new WP_Query( array( 'post_type' => 'post' ) ); 361 $this->assert Contains(361 $this->assertStringContainsString( 362 362 "ORDER BY $wpdb->posts.post_date DESC", 363 363 $q4->request … … 378 378 ) 379 379 ); 380 $this->assert Contains(380 $this->assertStringContainsString( 381 381 "ORDER BY $wpdb->posts.post_type DESC", 382 382 $q1->request … … 389 389 ) 390 390 ); 391 $this->assert Contains(391 $this->assertStringContainsString( 392 392 "ORDER BY $wpdb->posts.post_title DESC", 393 393 $q2->request … … 399 399 ) 400 400 ); 401 $this->assert Contains(401 $this->assertStringContainsString( 402 402 "ORDER BY $wpdb->posts.post_date ASC", 403 403 $q3->request … … 411 411 // 'rand' is a valid value. 412 412 $q = new WP_Query( array( 'orderby' => 'rand' ) ); 413 $this->assert Contains( 'ORDER BY RAND()', $q->request );414 $this->assert NotContains( 'ASC', $q->request );415 $this->assert NotContains( 'DESC', $q->request );413 $this->assertStringContainsString( 'ORDER BY RAND()', $q->request ); 414 $this->assertStringNotContainsString( 'ASC', $q->request ); 415 $this->assertStringNotContainsString( 'DESC', $q->request ); 416 416 417 417 // This isn't allowed. 418 418 $q2 = new WP_Query( array( 'order' => 'rand' ) ); 419 $this->assert Contains( 'ORDER BY', $q2->request );420 $this->assert NotContains( 'RAND()', $q2->request );421 $this->assert Contains( 'DESC', $q2->request );419 $this->assertStringContainsString( 'ORDER BY', $q2->request ); 420 $this->assertStringNotContainsString( 'RAND()', $q2->request ); 421 $this->assertStringContainsString( 'DESC', $q2->request ); 422 422 423 423 // 'none' is a valid value. 424 424 $q3 = new WP_Query( array( 'orderby' => 'none' ) ); 425 $this->assert NotContains( 'ORDER BY', $q3->request );426 $this->assert NotContains( 'DESC', $q3->request );427 $this->assert NotContains( 'ASC', $q3->request );425 $this->assertStringNotContainsString( 'ORDER BY', $q3->request ); 426 $this->assertStringNotContainsString( 'DESC', $q3->request ); 427 $this->assertStringNotContainsString( 'ASC', $q3->request ); 428 428 429 429 // False is a valid value. 430 430 $q4 = new WP_Query( array( 'orderby' => false ) ); 431 $this->assert NotContains( 'ORDER BY', $q4->request );432 $this->assert NotContains( 'DESC', $q4->request );433 $this->assert NotContains( 'ASC', $q4->request );431 $this->assertStringNotContainsString( 'ORDER BY', $q4->request ); 432 $this->assertStringNotContainsString( 'DESC', $q4->request ); 433 $this->assertStringNotContainsString( 'ASC', $q4->request ); 434 434 435 435 // Empty array() is a valid value. 436 436 $q5 = new WP_Query( array( 'orderby' => array() ) ); 437 $this->assert NotContains( 'ORDER BY', $q5->request );438 $this->assert NotContains( 'DESC', $q5->request );439 $this->assert NotContains( 'ASC', $q5->request );437 $this->assertStringNotContainsString( 'ORDER BY', $q5->request ); 438 $this->assertStringNotContainsString( 'DESC', $q5->request ); 439 $this->assertStringNotContainsString( 'ASC', $q5->request ); 440 440 } 441 441 … … 450 450 ); 451 451 452 $this->assert Contains( 'ORDER BY RAND(5)', $q->request );452 $this->assertStringContainsString( 'ORDER BY RAND(5)', $q->request ); 453 453 } 454 454 … … 463 463 ); 464 464 465 $this->assert NotContains( 'ORDER BY RAND', $q->request );465 $this->assertStringNotContainsString( 'ORDER BY RAND', $q->request ); 466 466 } 467 467 … … 476 476 ); 477 477 478 $this->assert Contains( 'ORDER BY RAND(5)', $q->request );478 $this->assertStringContainsString( 'ORDER BY RAND(5)', $q->request ); 479 479 } 480 480
Note: See TracChangeset
for help on using the changeset viewer.