Make WordPress Core


Ignore:
Timestamp:
09/25/2021 01:27:47 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Tests: Remove unnecessary setUp() and tearDown() methods in multisite tests.

These were originally added in [26252] to suppress database errors on setUp() and restore on tearDown() for tests that call wpmu_create_blog(), blog factory, or installation code that attempts to clear transients.

As the multisite test coverage expanded, these methods ended up being unnecessarily copied into other test classes, where database error suppression is not required.

Follow-up to [26252], [29916], [30286], [33184], [34898], [34899], [34901], [37234], [37477], [37894], [49212], [49616], [51859].

See #53363.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/network.php

    r51568 r51869  
    1111    class Tests_Multisite_Network extends WP_UnitTestCase {
    1212        protected $plugin_hook_count = 0;
    13         protected $suppress          = false;
    1413
    1514        protected static $different_network_id;
    1615        protected static $different_site_ids = array();
    1716
    18         function set_up() {
    19             global $wpdb;
    20             parent::set_up();
    21             $this->suppress = $wpdb->suppress_errors();
    22         }
    23 
    2417        function tear_down() {
    25             global $wpdb, $current_site;
    26             $wpdb->suppress_errors( $this->suppress );
     18            global $current_site;
    2719            $current_site->id = 1;
    2820            parent::tear_down();
     
    591583         */
    592584        public function test_wpmu_create_blog_updates_correct_network_site_count() {
     585            global $wpdb;
     586
    593587            $original_count = get_blog_count( self::$different_network_id );
    594588
    595             $site_id = wpmu_create_blog( 'example.org', '/', '', 1, array(), self::$different_network_id );
     589            $suppress = $wpdb->suppress_errors();
     590            $site_id  = wpmu_create_blog( 'example.org', '/', '', 1, array(), self::$different_network_id );
     591            $wpdb->suppress_errors( $suppress );
    596592
    597593            $result = get_blog_count( self::$different_network_id );
Note: See TracChangeset for help on using the changeset viewer.