mirror of
https://gh.wpcy.net/https://github.com/buddypress/buddypress.git
synced 2026-05-31 05:04:29 +08:00
Using these polyfills let us use PHPUnit v9.x for our tests and add PHP 8.1 to our testing matrix. Some additional edits to our PHP unit tests suite were needed: - Stop using PHPunit deprecated functions. - Rename some `BP_UnitTestCase` methods to use Yoast's polyfills. - Edit the PHP Unit test GH action and also run this action on pull requests. - Update some composer dependencies, remove the one about `phpunit/phpunit:^7.5` and add a new composer script to use PHPUnit v9.x. Props renatonascalves, rafiahmedd Closes https://github.com/buddypress/buddypress/pull/13 Fixes #8649 git-svn-id: https://buddypress.svn.wordpress.org/trunk@13314 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
30 lines
1 KiB
PHP
30 lines
1 KiB
PHP
<?php
|
|
const WP_TESTS_PHPUNIT_POLYFILLS_PATH = __DIR__ . '/../../vendor/yoast/phpunit-polyfills';
|
|
|
|
if ( defined( 'BP_USE_WP_ENV_TESTS' ) ) {
|
|
// wp-env setup.
|
|
define( 'WP_TESTS_CONFIG_FILE_PATH', dirname( __FILE__ ) . '/assets/phpunit-wp-config.php' );
|
|
define( 'WP_TESTS_CONFIG_PATH', WP_TESTS_CONFIG_FILE_PATH );
|
|
|
|
// Use WP PHPUnit.
|
|
require_once dirname( dirname( dirname( __FILE__ ) ) ) . '/vendor/wp-phpunit/wp-phpunit/__loaded.php';
|
|
}
|
|
|
|
require( dirname( __FILE__ ) . '/includes/define-constants.php' );
|
|
|
|
if ( ! file_exists( WP_TESTS_DIR . '/includes/functions.php' ) ) {
|
|
die( "The WordPress PHPUnit test suite could not be found.\n" );
|
|
}
|
|
|
|
require_once WP_TESTS_DIR . '/includes/functions.php';
|
|
|
|
function _install_and_load_buddypress() {
|
|
require BP_TESTS_DIR . '/includes/loader.php';
|
|
}
|
|
tests_add_filter( 'muplugins_loaded', '_install_and_load_buddypress' );
|
|
|
|
require WP_TESTS_DIR . '/includes/bootstrap.php';
|
|
|
|
// Load the BP-specific testing tools
|
|
require BP_TESTS_DIR . '/includes/testcase.php';
|
|
require BP_TESTS_DIR . '/includes/testcase-emails.php';
|