2019-10-24 00:25:32 +03:00
< ? php
2019-11-15 17:40:18 +02:00
/**
* PHPUnit bootstrap file
*/
2019-10-24 00:25:32 +03:00
2019-11-15 17:40:18 +02:00
$_tests_dir = getenv ( 'WP_TESTS_DIR' );
2019-10-24 00:25:32 +03:00
2019-11-15 17:40:18 +02:00
if ( ! $_tests_dir ) {
$_tests_dir = rtrim ( sys_get_temp_dir (), '/\\' ) . '/wordpress-tests-lib' ;
2019-10-24 00:25:32 +03:00
}
2019-11-15 17:40:18 +02:00
if ( ! file_exists ( $_tests_dir . '/includes/functions.php' ) ) {
echo " Could not find $_tests_dir /includes/functions.php, have you run bin/install-wp-tests.sh ? " . PHP_EOL ; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
exit ( 1 );
2019-10-24 00:25:32 +03:00
}
2019-11-15 17:40:18 +02:00
// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php' ;
2019-10-24 00:25:32 +03:00
2019-11-15 17:40:18 +02:00
/**
* Manually load the plugin being tested .
*/
function _manually_load_plugin () {
require dirname ( dirname ( __FILE__ ) ) . '/index.php' ;
}
tests_add_filter ( 'muplugins_loaded' , '_manually_load_plugin' );
2019-10-24 00:25:32 +03:00
2019-11-15 17:40:18 +02:00
// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php' ;