forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetSite.php
More file actions
44 lines (35 loc) · 1.12 KB
/
getSite.php
File metadata and controls
44 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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;
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 );
}
unset( $id );
}
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 );
}
}
endif;