WordPress.org

Make WordPress Core

Changeset 51641


Ignore:
Timestamp:
08/19/2021 01:59:36 PM (4 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/wpCommunityEvents.php

    r51639 r51641  
    2828
    2929    /**
     30     * Performs setup tasks before the first test is run.
     31     *
     32     * @since 5.9.0
     33     */
     34    public static function set_up_before_class() {
     35        parent::set_up_before_class();
     36
     37        require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
     38    }
     39
     40    /**
    3041     * Performs setup tasks for every test.
    3142     *
     
    3445    public function set_up() {
    3546        parent::set_up();
    36 
    37         require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
    3847
    3948        $this->instance = new WP_Community_Events( 1, $this->get_user_location() );
Note: See TracChangeset for help on using the changeset viewer.