wordpress-activitypub/tests/bootstrap.php

34 lines
1.1 KiB
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';
2022-12-02 13:43:09 +01:00
// Load the Friends plugin if available to test the integrations.
2022-12-02 12:46:42 +01:00
$friends_plugin = \dirname( \dirname( \dirname( __FILE__ ) ) ) . '/friends/friends.php';
if ( file_exists( $friends_plugin ) ) {
require $friends_plugin;
}
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';