forked from nb/wordpress-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
32 lines (23 loc) · 1.1 KB
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Installs WordPress for running the tests and loads WordPress and the test libraries
*/
error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
require_once 'PHPUnit/Autoload.php';
$config_file_path = dirname( __FILE__ ) . '/unittests-config.php';
/*
Globalize some WordPress variables, because PHPUnit loads this file inside a function
See: https://github.com/sebastianbergmann/phpunit/issues/325
These are not needed for WordPress 3.3+, only for older versions
*/
global $table_prefix, $wp_embed, $wp_locale, $_wp_deprecated_widgets_callbacks, $wp_widget_factory;
// These are still needed
global $wpdb, $current_site, $current_blog, $wp_rewrite;
require_once $config_file_path;
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
system( 'php '.escapeshellarg( dirname( __FILE__ ) . '/bin/install.php' ) . ' ' . escapeshellarg( $config_file_path ) );
require_once ABSPATH . '/wp-settings.php';
require dirname( __FILE__ ) . '/lib/testcase.php';
require dirname( __FILE__ ) . '/lib/exceptions.php';