From 2aecc8f3e616156bd41fd8310368b88bc8c6c0b9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 8 Feb 2020 05:29:54 +0000 Subject: [PATCH] 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 --- src/wp-includes/functions.php | 1 + tests/phpunit/tests/functions/wp.php | 19 +++++++++++++++++++ tests/phpunit/tests/functions/wpAuthCheck.php | 4 ++-- .../phpunit/tests/functions/wpRemoteFopen.php | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tests/phpunit/tests/functions/wp.php diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index ef4d23debb..1a53c12eda 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -1270,6 +1270,7 @@ function wp_remote_fopen( $uri ) { */ function wp( $query_vars = '' ) { global $wp, $wp_query, $wp_the_query; + $wp->main( $query_vars ); if ( ! isset( $wp_the_query ) ) { diff --git a/tests/phpunit/tests/functions/wp.php b/tests/phpunit/tests/functions/wp.php new file mode 100644 index 0000000000..80654a8526 --- /dev/null +++ b/tests/phpunit/tests/functions/wp.php @@ -0,0 +1,19 @@ +assertInstanceOf( 'WP', $wp ); + $this->assertInstanceOf( 'WP_Query', $wp_query ); + $this->assertInstanceOf( 'WP_Query', $wp_the_query ); + } + +} diff --git a/tests/phpunit/tests/functions/wpAuthCheck.php b/tests/phpunit/tests/functions/wpAuthCheck.php index b8e9d2c645..32aafdddb1 100644 --- a/tests/phpunit/tests/functions/wpAuthCheck.php +++ b/tests/phpunit/tests/functions/wpAuthCheck.php @@ -1,9 +1,9 @@