Tests: Add a basic test for `wp()` function.

Props pbearne, donmhico.
Fixes #48844.

git-svn-id: https://develop.svn.wordpress.org/trunk@47212 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-02-08 05:29:54 +00:00
parent 11eb80e59e
commit 2aecc8f3e6
4 changed files with 23 additions and 3 deletions

View File

@ -1270,6 +1270,7 @@ function wp_remote_fopen( $uri ) {
*/ */
function wp( $query_vars = '' ) { function wp( $query_vars = '' ) {
global $wp, $wp_query, $wp_the_query; global $wp, $wp_query, $wp_the_query;
$wp->main( $query_vars ); $wp->main( $query_vars );
if ( ! isset( $wp_the_query ) ) { if ( ! isset( $wp_the_query ) ) {

View File

@ -0,0 +1,19 @@
<?php
/**
* @group functions.php
* @group query
*/
class Tests_Functions_WP extends WP_UnitTestCase {
public function test_wp_sets_global_vars() {
global $wp, $wp_query, $wp_the_query;
wp();
$this->assertInstanceOf( 'WP', $wp );
$this->assertInstanceOf( 'WP_Query', $wp_query );
$this->assertInstanceOf( 'WP_Query', $wp_the_query );
}
}

View File

@ -1,9 +1,9 @@
<?php <?php
/** /**
* @group functions.php
*
* Tests for the behavior of `wp_auth_check()` * Tests for the behavior of `wp_auth_check()`
*
* @group functions.php
*/ */
class Tests_Functions_WP_Auth_Check extends WP_UnitTestCase { class Tests_Functions_WP_Auth_Check extends WP_UnitTestCase {

View File

@ -4,7 +4,7 @@
* @group external-http * @group external-http
* @group functions.php * @group functions.php
*/ */
class Tests_wp_remote_fopen extends WP_UnitTestCase { class Tests_Functions_wp_remote_fopen extends WP_UnitTestCase {
/** /**
* @ticket 48845 * @ticket 48845