mirror of
https://github.com/buddypress/buddypress.git
synced 2026-07-22 20:56:55 +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
35 lines
861 B
PHP
35 lines
861 B
PHP
<?php
|
|
require_once dirname( __FILE__ ) . '/testcase.php';
|
|
|
|
class BP_UnitTestCase_Emails extends BP_UnitTestCase {
|
|
|
|
public static function set_up_before_class() {
|
|
parent::set_up_before_class();
|
|
|
|
require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php' );
|
|
|
|
/*
|
|
* WP's test suite wipes out BP's email posts.
|
|
* We must reestablish them before our tests can be successfully run.
|
|
*/
|
|
bp_core_install_emails();
|
|
}
|
|
|
|
public static function tear_down_after_class() {
|
|
$emails = get_posts( array(
|
|
'fields' => 'ids',
|
|
'post_status' => 'any',
|
|
'post_type' => bp_get_email_post_type(),
|
|
'posts_per_page' => 200,
|
|
'suppress_filters' => false,
|
|
) );
|
|
|
|
if ( $emails ) {
|
|
foreach ( $emails as $email_id ) {
|
|
wp_delete_post( $email_id, true );
|
|
}
|
|
}
|
|
|
|
parent::tear_down_after_class();
|
|
}
|
|
}
|