Add is_embed()
to WP_UnitTestCase::assertQueryTrue()
and update the relevant embed tests.
See #32522 git-svn-id: https://develop.svn.wordpress.org/trunk@35257 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6845b3cd4a
commit
9fbff7f63a
@ -524,10 +524,34 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
|||||||
function assertQueryTrue(/* ... */) {
|
function assertQueryTrue(/* ... */) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
$all = array(
|
$all = array(
|
||||||
'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
|
'is_404',
|
||||||
'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
|
'is_admin',
|
||||||
'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
|
'is_archive',
|
||||||
'is_posts_page', 'is_post_type_archive',
|
'is_attachment',
|
||||||
|
'is_author',
|
||||||
|
'is_category',
|
||||||
|
'is_comment_feed',
|
||||||
|
'is_comments_popup',
|
||||||
|
'is_date',
|
||||||
|
'is_day',
|
||||||
|
'is_embed',
|
||||||
|
'is_feed',
|
||||||
|
'is_home',
|
||||||
|
'is_month',
|
||||||
|
'is_page',
|
||||||
|
'is_paged',
|
||||||
|
'is_post_type_archive',
|
||||||
|
'is_posts_page',
|
||||||
|
'is_preview',
|
||||||
|
'is_robots',
|
||||||
|
'is_search',
|
||||||
|
'is_single',
|
||||||
|
'is_singular',
|
||||||
|
'is_tag',
|
||||||
|
'is_tax',
|
||||||
|
'is_time',
|
||||||
|
'is_trackback',
|
||||||
|
'is_year',
|
||||||
);
|
);
|
||||||
$true = func_get_args();
|
$true = func_get_args();
|
||||||
|
|
||||||
@ -550,9 +574,9 @@ class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
$message = '';
|
$message = '';
|
||||||
if ( count($not_true) )
|
if ( count($not_true) )
|
||||||
$message .= implode( $not_true, ', ' ) . ' should be true. ';
|
$message .= implode( $not_true, ', ' ) . ' is expected to be true. ';
|
||||||
if ( count($not_false) )
|
if ( count($not_false) )
|
||||||
$message .= implode( $not_false, ', ' ) . ' should be false.';
|
$message .= implode( $not_false, ', ' ) . ' is expected to be false.';
|
||||||
$this->assertTrue( $passed, $message );
|
$this->assertTrue( $passed, $message );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
) );
|
) );
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_single', 'is_singular' );
|
$this->assertQueryTrue( 'is_single', 'is_singular', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -43,7 +43,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_single', 'is_singular' );
|
$this->assertQueryTrue( 'is_single', 'is_singular', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -60,7 +60,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
$this->go_to( home_url( '/?p=123&embed=true' ) );
|
$this->go_to( home_url( '/?p=123&embed=true' ) );
|
||||||
$GLOBALS['wp_query']->query_vars['embed'] = true;
|
$GLOBALS['wp_query']->query_vars['embed'] = true;
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_404' );
|
$this->assertQueryTrue( 'is_404', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -83,7 +83,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $attachment_id ) );
|
$this->go_to( get_post_embed_url( $attachment_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_single', 'is_singular', 'is_attachment' );
|
$this->assertQueryTrue( 'is_single', 'is_singular', 'is_attachment', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -106,7 +106,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_404' );
|
$this->assertQueryTrue( 'is_404', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -128,7 +128,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_404' );
|
$this->assertQueryTrue( 'is_404', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -149,7 +149,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_404' );
|
$this->assertQueryTrue( 'is_404', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
@ -174,7 +174,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$this->go_to( get_post_embed_url( $post_id ) );
|
$this->go_to( get_post_embed_url( $post_id ) );
|
||||||
|
|
||||||
$this->assertQueryTrue( 'is_single', 'is_singular' );
|
$this->assertQueryTrue( 'is_single', 'is_singular', 'is_embed' );
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include( ABSPATH . WPINC . '/embed-template.php' );
|
include( ABSPATH . WPINC . '/embed-template.php' );
|
||||||
|
Loading…
Reference in New Issue
Block a user