forked from WP-API/WP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
34 lines (29 loc) · 1.19 KB
/
Copy pathbootstrap.php
File metadata and controls
34 lines (29 loc) · 1.19 KB
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
<?php
/**
* Bootstrap the plugin unit testing environment.
*
* @package WordPress
* @subpackage JSON API
*/
// Support for:
// 1. `WP_DEVELOP_DIR` environment variable
// 2. Plugin installed inside of WordPress.org developer checkout
// 3. Tests checked out to /tmp
if( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
$test_root = getenv( 'WP_DEVELOP_DIR' ) . '/tests/phpunit';
} else if ( file_exists( '../../../../tests/phpunit/includes/bootstrap.php' ) ) {
$test_root = '../../../../tests/phpunit';
} else if ( file_exists( '/tmp/wordpress-tests-lib/includes/bootstrap.php' ) ) {
$test_root = '/tmp/wordpress-tests-lib';
}
require $test_root . '/includes/functions.php';
function _manually_load_plugin() {
require dirname( __FILE__ ) . '/../plugin.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
require $test_root . '/includes/bootstrap.php';
// Helper classes
require_once dirname( __FILE__ ) . '/class-wp-test-json-testcase.php';
require_once dirname( __FILE__ ) . '/class-wp-test-json-controller-testcase.php';
require_once dirname( __FILE__ ) . '/class-wp-test-json-post-type-controller-testcase.php';
require_once dirname( __FILE__ ) . '/class-wp-test-spy-json-server.php';