wordpress-develop/tests/phpunit/tests/multisite.php
Gary Pendergast c6c78490e2 Coding Standards: Fix the remaining issues in /tests.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-08 00:55:20 +00:00

40 lines
956 B
PHP

<?php
if ( is_multisite() ) :
/**
* A set of unit tests for WordPress Multisite
*
* @group multisite
*/
class Tests_Multisite extends WP_UnitTestCase {
protected $suppress = false;
function setUp() {
global $wpdb;
parent::setUp();
$this->suppress = $wpdb->suppress_errors();
}
function tearDown() {
global $wpdb;
parent::tearDown();
$wpdb->suppress_errors( $this->suppress );
}
function test_wpmu_log_new_registrations() {
global $wpdb;
$user = new WP_User( 1 );
$ip = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
wpmu_log_new_registrations( 1, 1 );
// currently there is no wrapper function for the registration_log
$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 ) );
$this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog ) - 1 ] );
}
}
endif;