wordpress-activitypub/tests/bootstrap.php

28 lines
883 B
PHP
Raw Normal View History

2018-09-24 20:53:23 +02:00
<?php
$_tests_dir = \getenv( 'WP_TESTS_DIR' );
2020-05-14 22:25:29 +02:00
2018-09-24 20:53:23 +02:00
if ( ! $_tests_dir ) {
2020-05-14 22:25:29 +02:00
$_tests_dir = \rtrim( \sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
2018-09-24 20:53:23 +02:00
}
2020-05-14 22:25:29 +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 );
}
// Give access to tests_add_filter() function.
2018-09-24 20:53:23 +02:00
require_once $_tests_dir . '/includes/functions.php';
2020-05-14 22:25:29 +02:00
/**
* Manually load the plugin being tested.
*/
2018-09-24 20:53:23 +02:00
function _manually_load_plugin() {
require \dirname( \dirname( __FILE__ ) ) . '/activitypub.php';
2018-09-24 20:53:23 +02:00
}
2020-05-12 20:30:06 +02:00
\tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
2018-09-24 20:53:23 +02:00
2020-05-14 22:25:29 +02:00
// Start up the WP testing environment.
2018-09-24 20:53:23 +02:00
require $_tests_dir . '/includes/bootstrap.php';
require __DIR__ . '/class-activitypub-testcase-cache-http.php';