-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathbootstrap.php
54 lines (46 loc) · 1.35 KB
/
bootstrap.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
ini_set( 'display_errors', 'on' );
error_reporting( E_ALL );
/**
* Set `WP_TESTS_DIR` to the base directory of WordPress:
* `svn export http://develop.svn.wordpress.org/trunk/ /tmp/wordpress-tests`
*
* Then add this to your bash environment:
*
* export WP_TESTS_DIR=/tmp/wordpress/tests
*/
if ( ! $wp_test_dir = getenv( 'WP_TESTS_DIR' ) ) {
$wp_test_dir = '/tmp/wordpress-tests-lib';
if ( ! file_exists( $wp_test_dir . '/includes' ) ) {
die( "Fatal Error: Could not find the WordPress tests directory.\n" );
}
}
/**
* Loads WP utility functions like `tests_add_filter` and `_delete_all_posts`.
*/
require_once $wp_test_dir . '/includes/functions.php';
/**
* Preset wp_options before loading the WordPress stack.
*
* Used to activate themes, plugins, as well as other settings in `wp_options`.
*
* @see wp_tests_options
*/
$GLOBALS['wp_tests_options'] = [
'active_plugins' => [
'hello.php',
],
];
/**
* Run custom functionality after mu-plugins are loaded.
*/
function _tests_load_cptui() {
define( 'CPTUI_DIRECTORY_PATH', trailingslashit( dirname( dirname( __FILE__ ) ) ) );
require CPTUI_DIRECTORY_PATH . '/vendor/autoload.php';
require CPTUI_DIRECTORY_PATH . 'custom-post-type-ui.php';
}
tests_add_filter( 'muplugins_loaded', '_tests_load_cptui' );
/**
* Bootstraps the WordPress stack.
*/
require $wp_test_dir . '/includes/bootstrap.php';