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
51 lines (43 loc) · 1.13 KB
/
getSite.php
File metadata and controls
51 lines (43 loc) · 1.13 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
45
46
47
48
49
50
51
<?php
/**
* Test get_site() wrapper of WP_Site in multisite.
*
* @group ms-required
* @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 );
}
}