wordpress-activitypub/tests/bootstrap.php
Jan Boddez dabff80cc2
Add like handler (#804)
* Update class-comment.php

* Initial attempt

* Register like handler

* Add support for undoing likes

* add support for announce

and copied basic comment_type support handling from the Webmention plugin

* fix merge issues

* remove C&P issues

* add missing phpdoc

* Disable Announces and Likes by default.

* set ACTIVITYPUB_DISABLE_REACTIONS to false

* refactorings

* fix escaping

* add default object type

* deduplicate code

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-08-16 12:55:16 +02:00

34 lines
1.2 KiB
PHP

<?php
\define( 'ACTIVITYPUB_DISABLE_REACTIONS', false );
$_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 "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.
require_once $_tests_dir . '/includes/functions.php';
/**
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
require \dirname( __DIR__ ) . '/activitypub.php';
$enable_mastodon_apps_plugin = dirname( dirname( __DIR__ ) ) . '/enable-mastodon-apps/enable-mastodon-apps.php'; // phpcs:ignore
if ( file_exists( $enable_mastodon_apps_plugin ) ) {
require $enable_mastodon_apps_plugin;
}
}
\tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';
require __DIR__ . '/class-activitypub-testcase-cache-http.php';
\Activitypub\Migration::add_default_settings();