Changeset 42343 for trunk/tests/phpunit/tests/multisite.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/multisite.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite.php
r34172 r42343 3 3 if ( is_multisite() ) : 4 4 5 /**6 * A set of unit tests for WordPress Multisite7 *8 * @group multisite9 */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; 12 12 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 } 17 37 } 18 38 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_log34 $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 39 39 endif;
Note: See TracChangeset
for help on using the changeset viewer.