mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1,44 +1,53 @@
|
||||
<?php
|
||||
|
||||
if ( is_multisite() ) :
|
||||
/**
|
||||
* Test get_site() wrapper of WP_Site in multisite.
|
||||
*
|
||||
* @group ms-site
|
||||
* @group multisite
|
||||
*/
|
||||
class Tests_Multisite_Get_Site extends WP_UnitTestCase {
|
||||
protected static $site_ids;
|
||||
/**
|
||||
* Test get_site() wrapper of WP_Site in multisite.
|
||||
*
|
||||
* @group ms-site
|
||||
* @group multisite
|
||||
*/
|
||||
class Tests_Multisite_Get_Site extends WP_UnitTestCase {
|
||||
protected static $site_ids;
|
||||
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$site_ids = array(
|
||||
'wordpress.org/' => array( 'domain' => 'wordpress.org', 'path' => '/' ),
|
||||
'wordpress.org/foo/' => array( 'domain' => 'wordpress.org', 'path' => '/foo/' ),
|
||||
'wordpress.org/foo/bar/' => array( 'domain' => 'wordpress.org', 'path' => '/foo/bar/' ),
|
||||
);
|
||||
public static function wpSetUpBeforeClass( $factory ) {
|
||||
self::$site_ids = array(
|
||||
'wordpress.org/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
'path' => '/',
|
||||
),
|
||||
'wordpress.org/foo/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
'path' => '/foo/',
|
||||
),
|
||||
'wordpress.org/foo/bar/' => array(
|
||||
'domain' => 'wordpress.org',
|
||||
'path' => '/foo/bar/',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( self::$site_ids as &$id ) {
|
||||
$id = $factory->blog->create( $id );
|
||||
foreach ( self::$site_ids as &$id ) {
|
||||
$id = $factory->blog->create( $id );
|
||||
}
|
||||
unset( $id );
|
||||
}
|
||||
unset( $id );
|
||||
}
|
||||
|
||||
public static function wpTearDownAfterClass() {
|
||||
foreach( self::$site_ids as $id ) {
|
||||
wpmu_delete_blog( $id, true );
|
||||
public static function wpTearDownAfterClass() {
|
||||
foreach ( self::$site_ids as $id ) {
|
||||
wpmu_delete_blog( $id, true );
|
||||
}
|
||||
|
||||
wp_update_network_site_counts();
|
||||
}
|
||||
|
||||
public function test_get_site_in_switched_state_returns_switched_site() {
|
||||
switch_to_blog( self::$site_ids['wordpress.org/foo/'] );
|
||||
$site = get_site();
|
||||
restore_current_blog();
|
||||
|
||||
$this->assertEquals( self::$site_ids['wordpress.org/foo/'], $site->id );
|
||||
}
|
||||
|
||||
wp_update_network_site_counts();
|
||||
}
|
||||
|
||||
public function test_get_site_in_switched_state_returns_switched_site() {
|
||||
switch_to_blog( self::$site_ids[ 'wordpress.org/foo/' ] );
|
||||
$site = get_site();
|
||||
restore_current_blog();
|
||||
|
||||
$this->assertEquals( self::$site_ids[ 'wordpress.org/foo/'], $site->id );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user