2019-10-24 00:25:32 +03:00
< ? php
2019-11-16 00:40:53 +02:00
/**
* PHPUnit bootstrap file
*/
2019-10-24 00:25:32 +03:00
2019-11-16 00:40:53 +02:00
$_tests_dir = getenv ( 'WP_TESTS_DIR' );
2019-10-24 00:25:32 +03:00
2019-11-16 00:40:53 +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-16 00:40:53 +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-16 00:40:53 +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-16 00:40:53 +02:00
/**
* Manually load the plugin being tested .
*/
function _manually_load_plugin () {
2024-08-27 20:40:37 +03:00
if ( ! defined ( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) {
define ( 'WPORG_SUPPORT_FORUMS_BLOGID' , 1 );
}
2023-03-01 02:16:31 +02:00
2024-08-27 20:40:37 +03:00
require dirname ( __DIR__ , 1 ) . '/index.php' ;
2022-08-18 18:12:40 +03:00
require __DIR__ . '/helpers.php' ;
2019-11-16 00:40:53 +02:00
}
tests_add_filter ( 'muplugins_loaded' , '_manually_load_plugin' );
2019-10-24 00:25:32 +03:00
2019-11-16 00:40:53 +02:00
// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php' ;