When I run `wp core is-installed`
Then it should run without errors
+ When I run `wp eval 'var_export( is_admin() );'`
+ Then it should run without errors
+ And STDOUT should be:
+ """
+ true
+ """
+
+ When I run `wp eval 'var_export( function_exists( 'media_handle_upload' ) );'`
+ Then it should run without errors
+ And STDOUT should be:
+ """
+ true
+ """
+
Scenario: Custom wp-content directory
Given a WP install
And a custom wp-content directory
Utils\set_user( $this->config );
- if ( !defined( 'WP_INSTALLING' ) && isset( $this->config['url'] ) )
- Utils\set_wp_query();
-
if ( isset( $this->config['require'] ) )
require $this->config['require'];
}
}
-function set_wp_query() {
- if ( isset( $GLOBALS['wp_query'] ) && isset( $GLOBALS['wp'] ) ) {
- $GLOBALS['wp']->parse_request();
- $GLOBALS['wp_query']->query($GLOBALS['wp']->query_vars);
- }
-}
-
function get_upgrader( $class ) {
if ( !class_exists( '\WP_Upgrader' ) )
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
WP_CLI::$runner->before_wp_load();
-// Load WordPress, in the global scope
+// Load wp-config.php code, in the global scope
eval( WP_CLI::$runner->get_wp_config_code() );
WP_CLI::$runner->after_wp_config_load();
+// Load main WordPress code, in the global scope
require WP_CLI_ROOT . 'wp-settings-cli.php';
// Fix memory limit. See http://core.trac.wordpress.org/ticket/14889
@ini_set( 'memory_limit', -1 );
-// Load all admin utilities
+// Simulate a /wp-admin/ page load
+$_SERVER['PHP_SELF'] = '/wp-admin/index.php';
+define( 'WP_ADMIN', true );
require ABSPATH . 'wp-admin/includes/admin.php';
+do_action( 'admin_init' );
WP_CLI::$runner->after_wp_load();