-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
30 lines (24 loc) · 852 Bytes
/
bootstrap.php
File metadata and controls
30 lines (24 loc) · 852 Bytes
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
<?php
/**
* PHPUnit bootstrap — loads the WordPress test environment.
*/
$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
}
if ( ! file_exists( "{$_tests_dir}/includes/functions.php" ) ) {
echo "Error: WordPress test library not found at {$_tests_dir}." . PHP_EOL;
echo "Run: composer run install-wp-tests (or see README.md)" . PHP_EOL;
exit( 1 );
}
// Make tests_add_filter() available.
require "{$_tests_dir}/includes/functions.php";
/**
* Load plugin functions (without the filter registrations).
*/
function _register_article_functions(): void {
require dirname( __DIR__ ) . '/includes/functions.php';
}
tests_add_filter( 'muplugins_loaded', '_register_article_functions' );
// Boot WordPress.
require "{$_tests_dir}/includes/bootstrap.php";