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/user/multisite.php

    r51568 r51869  
    1111     */
    1212    class Tests_Multisite_User extends WP_UnitTestCase {
    13         protected $suppress = false;
    14 
    15         function set_up() {
    16             global $wpdb;
    17             parent::set_up();
    18             $this->suppress = $wpdb->suppress_errors();
    19         }
    20 
    21         function tear_down() {
    22             global $wpdb;
    23             $wpdb->suppress_errors( $this->suppress );
    24             parent::tear_down();
    25         }
    2613
    2714        function test_remove_user_from_blog() {
     
    396383         */
    397384        public function test_add_user_to_blog_invalid_user() {
     385            global $wpdb;
     386
    398387            $site_id = self::factory()->blog->create();
    399388
    400             $result = add_user_to_blog( 73622, $site_id, 'subscriber' );
     389            $suppress = $wpdb->suppress_errors();
     390            $result   = add_user_to_blog( 73622, $site_id, 'subscriber' );
     391            $wpdb->suppress_errors( $suppress );
    401392
    402393            wp_delete_site( $site_id );
Note: See TracChangeset for help on using the changeset viewer.