Make WordPress Core


Ignore:
Timestamp:
04/09/2025 01:29:39 PM (20 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use the ms-required group where appropriate.

This replaces the if ( is_multisite() ) conditional wrapping entire test classes with the ms-required group for more consistency across the test suite.

Follow-up to [40520].

See #63167.

File:
1 edited

Legend:

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

    r54726 r60148  
    11<?php
    22
    3 if ( is_multisite() ) :
     3/**
     4 * @group ms-required
     5 * @group multisite
     6 */
     7class Tests_Multisite_wpmuLogNewRegistrations extends WP_UnitTestCase {
    48
    5         /**
    6          * @group multisite
    7          */
    8         class Tests_Multisite_wpmuLogNewRegistrations extends WP_UnitTestCase {
     9        public function test_wpmu_log_new_registrations() {
     10                global $wpdb;
    911
    10                 public function test_wpmu_log_new_registrations() {
    11                         global $wpdb;
     12                $user = new WP_User( 1 );
     13                $ip   = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
    1214
    13                         $user = new WP_User( 1 );
    14                         $ip   = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
     15                wpmu_log_new_registrations( 1, 1 );
    1516
    16                         wpmu_log_new_registrations( 1, 1 );
    17 
    18                         // Currently there is no wrapper function for the registration_log.
    19                         $reg_blog = $wpdb->get_col( $wpdb->prepare( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE %s", $ip ) );
    20                         $this->assertSame( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
    21                 }
     17                // Currently there is no wrapper function for the registration_log.
     18                $reg_blog = $wpdb->get_col( $wpdb->prepare( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE %s", $ip ) );
     19                $this->assertSame( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
    2220        }
    23 
    24 endif;
     21}
Note: See TracChangeset for help on using the changeset viewer.