mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Tests: Move loading the WP_Community_Events class to set_up_before_class().
This ensures that the class is loaded once before the first test of the test case class is run, and `require_once()` is not unnecessarily called for each test method individually. Follow-up to [40607], [51628]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51641 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -26,6 +26,17 @@ class Tests_Admin_wpCommunityEvents extends WP_UnitTestCase {
|
||||
*/
|
||||
private $instance;
|
||||
|
||||
/**
|
||||
* Performs setup tasks before the first test is run.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*/
|
||||
public static function set_up_before_class() {
|
||||
parent::set_up_before_class();
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs setup tasks for every test.
|
||||
*
|
||||
@@ -34,8 +45,6 @@ class Tests_Admin_wpCommunityEvents extends WP_UnitTestCase {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
|
||||
|
||||
$this->instance = new WP_Community_Events( 1, $this->get_user_location() );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user