Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r34172 r42343  
    33if ( is_multisite() ) :
    44
    5 /**
    6  * A set of unit tests for WordPress Multisite
    7  *
    8  * @group multisite
    9  */
    10 class Tests_Multisite extends WP_UnitTestCase {
    11     protected $suppress = false;
     5    /**
     6    * A set of unit tests for WordPress Multisite
     7    *
     8    * @group multisite
     9    */
     10    class Tests_Multisite extends WP_UnitTestCase {
     11        protected $suppress = false;
    1212
    13     function setUp() {
    14         global $wpdb;
    15         parent::setUp();
    16         $this->suppress = $wpdb->suppress_errors();
     13        function setUp() {
     14            global $wpdb;
     15            parent::setUp();
     16            $this->suppress = $wpdb->suppress_errors();
     17        }
     18
     19        function tearDown() {
     20            global $wpdb;
     21            parent::tearDown();
     22            $wpdb->suppress_errors( $this->suppress );
     23        }
     24
     25        function test_wpmu_log_new_registrations() {
     26            global $wpdb;
     27
     28            $user = new WP_User( 1 );
     29            $ip   = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
     30
     31            wpmu_log_new_registrations( 1, 1 );
     32
     33            // currently there is no wrapper function for the registration_log
     34            $reg_blog = $wpdb->get_col( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE '" . $ip . "'" );
     35            $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
     36        }
    1737    }
    1838
    19     function tearDown() {
    20         global $wpdb;
    21         parent::tearDown();
    22         $wpdb->suppress_errors( $this->suppress );
    23     }
    24 
    25     function test_wpmu_log_new_registrations() {
    26         global $wpdb;
    27 
    28         $user = new WP_User( 1 );
    29         $ip = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
    30 
    31         wpmu_log_new_registrations(1,1);
    32 
    33         // currently there is no wrapper function for the registration_log
    34         $reg_blog = $wpdb->get_col( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE '" . $ip . "'" );
    35         $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog )-1 ] );
    36     }
    37 }
    38 
    3939endif;
Note: See TracChangeset for help on using the changeset viewer.