mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51860 602fd350-edb4-49c9-b593-d223f7449a82
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
if ( is_multisite() ) :
|
|
/**
|
|
* Test get_site() wrapper of WP_Site in multisite.
|
|
*
|
|
* @group ms-site
|
|
* @group multisite
|
|
*/
|
|
class Tests_Multisite_GetSite extends WP_UnitTestCase {
|
|
protected static $site_ids;
|
|
|
|
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $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 );
|
|
}
|
|
unset( $id );
|
|
}
|
|
|
|
public static function wpTearDownAfterClass() {
|
|
foreach ( self::$site_ids as $id ) {
|
|
wp_delete_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->assertSame( self::$site_ids['wordpress.org/foo/'], $site->id );
|
|
}
|
|
|
|
}
|
|
|
|
endif;
|