Build/Test Tools: Add support for is_front_page() to assertQueryTrue() and assert that all the tested conditions are supported by the method.

Fixes #37849


git-svn-id: https://develop.svn.wordpress.org/trunk@38405 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2016-08-27 15:27:35 +00:00
parent 7b275f6a07
commit 417de45c08
2 changed files with 7 additions and 2 deletions

View File

@ -577,6 +577,7 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
'is_day',
'is_embed',
'is_feed',
'is_front_page',
'is_home',
'is_month',
'is_page',
@ -596,6 +597,10 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
);
$true = func_get_args();
foreach ( $true as $true_thing ) {
$this->assertContains( $true_thing, $all, "{$true_thing}() is not handled by assertQueryTrue()." );
}
$passed = true;
$not_false = $not_true = array(); // properties that were not set to expected values

View File

@ -29,7 +29,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
function test_home() {
$this->go_to('/');
$this->assertQueryTrue('is_home');
$this->assertQueryTrue( 'is_home', 'is_front_page' );
}
function test_404() {
@ -255,7 +255,7 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
self::factory()->post->create_many( 5 );
for ( $i = 2; $i <= 3; $i++ ) {
$this->go_to("/page/{$i}/");
$this->assertQueryTrue('is_home', 'is_paged');
$this->assertQueryTrue( 'is_home', 'is_front_page', 'is_paged' );
}
}