Skip to content

Commit d26fdc0

Browse files
author
costdev
committed
Tests: Replace is_multisite() with ms-required group.
1 parent 92a05b4 commit d26fdc0

2 files changed

Lines changed: 200 additions & 204 deletions

File tree

Lines changed: 108 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,125 @@
11
<?php
22

3-
if ( is_multisite() ) :
3+
/**
4+
* @group ms-required
5+
* @group admin
6+
* @group network-admin
7+
*
8+
* @covers WP_MS_Themes_List_Table
9+
*/
10+
class Tests_Multisite_wpMsThemesListTable extends WP_UnitTestCase {
11+
protected static $site_ids;
412

513
/**
6-
* @group admin
7-
* @group network-admin
8-
*
9-
* @covers WP_MS_Themes_List_Table
14+
* @var WP_MS_Themes_List_Table
1015
*/
11-
class Tests_Multisite_wpMsThemesListTable extends WP_UnitTestCase {
12-
protected static $site_ids;
13-
14-
/**
15-
* @var WP_MS_Themes_List_Table
16-
*/
17-
public $table = false;
16+
public $table = false;
1817

19-
public function set_up() {
20-
parent::set_up();
21-
$this->table = _get_list_table( 'WP_MS_Themes_List_Table', array( 'screen' => 'ms-themes' ) );
22-
}
18+
public function set_up() {
19+
parent::set_up();
20+
$this->table = _get_list_table( 'WP_MS_Themes_List_Table', array( 'screen' => 'ms-themes' ) );
21+
}
2322

24-
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
25-
self::$site_ids = array(
26-
'wordpress.org/' => array(
27-
'domain' => 'wordpress.org',
28-
'path' => '/',
29-
),
30-
'wordpress.org/foo/' => array(
31-
'domain' => 'wordpress.org',
32-
'path' => '/foo/',
33-
),
34-
'wordpress.org/foo/bar/' => array(
35-
'domain' => 'wordpress.org',
36-
'path' => '/foo/bar/',
37-
),
38-
'wordpress.org/afoo/' => array(
39-
'domain' => 'wordpress.org',
40-
'path' => '/afoo/',
41-
),
42-
'make.wordpress.org/' => array(
43-
'domain' => 'make.wordpress.org',
44-
'path' => '/',
45-
),
46-
'make.wordpress.org/foo/' => array(
47-
'domain' => 'make.wordpress.org',
48-
'path' => '/foo/',
49-
),
50-
'www.w.org/' => array(
51-
'domain' => 'www.w.org',
52-
'path' => '/',
53-
),
54-
'www.w.org/foo/' => array(
55-
'domain' => 'www.w.org',
56-
'path' => '/foo/',
57-
),
58-
'www.w.org/foo/bar/' => array(
59-
'domain' => 'www.w.org',
60-
'path' => '/foo/bar/',
61-
),
62-
'test.example.org/' => array(
63-
'domain' => 'test.example.org',
64-
'path' => '/',
65-
),
66-
'test2.example.org/' => array(
67-
'domain' => 'test2.example.org',
68-
'path' => '/',
69-
),
70-
'test3.example.org/zig/' => array(
71-
'domain' => 'test3.example.org',
72-
'path' => '/zig/',
73-
),
74-
'atest.example.org/' => array(
75-
'domain' => 'atest.example.org',
76-
'path' => '/',
77-
),
78-
);
23+
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
24+
self::$site_ids = array(
25+
'wordpress.org/' => array(
26+
'domain' => 'wordpress.org',
27+
'path' => '/',
28+
),
29+
'wordpress.org/foo/' => array(
30+
'domain' => 'wordpress.org',
31+
'path' => '/foo/',
32+
),
33+
'wordpress.org/foo/bar/' => array(
34+
'domain' => 'wordpress.org',
35+
'path' => '/foo/bar/',
36+
),
37+
'wordpress.org/afoo/' => array(
38+
'domain' => 'wordpress.org',
39+
'path' => '/afoo/',
40+
),
41+
'make.wordpress.org/' => array(
42+
'domain' => 'make.wordpress.org',
43+
'path' => '/',
44+
),
45+
'make.wordpress.org/foo/' => array(
46+
'domain' => 'make.wordpress.org',
47+
'path' => '/foo/',
48+
),
49+
'www.w.org/' => array(
50+
'domain' => 'www.w.org',
51+
'path' => '/',
52+
),
53+
'www.w.org/foo/' => array(
54+
'domain' => 'www.w.org',
55+
'path' => '/foo/',
56+
),
57+
'www.w.org/foo/bar/' => array(
58+
'domain' => 'www.w.org',
59+
'path' => '/foo/bar/',
60+
),
61+
'test.example.org/' => array(
62+
'domain' => 'test.example.org',
63+
'path' => '/',
64+
),
65+
'test2.example.org/' => array(
66+
'domain' => 'test2.example.org',
67+
'path' => '/',
68+
),
69+
'test3.example.org/zig/' => array(
70+
'domain' => 'test3.example.org',
71+
'path' => '/zig/',
72+
),
73+
'atest.example.org/' => array(
74+
'domain' => 'atest.example.org',
75+
'path' => '/',
76+
),
77+
);
7978

80-
foreach ( self::$site_ids as &$id ) {
81-
$id = $factory->blog->create( $id );
82-
}
83-
unset( $id );
79+
foreach ( self::$site_ids as &$id ) {
80+
$id = $factory->blog->create( $id );
8481
}
82+
unset( $id );
83+
}
8584

86-
public static function wpTearDownAfterClass() {
87-
foreach ( self::$site_ids as $site_id ) {
88-
wp_delete_site( $site_id );
89-
}
85+
public static function wpTearDownAfterClass() {
86+
foreach ( self::$site_ids as $site_id ) {
87+
wp_delete_site( $site_id );
9088
}
89+
}
9190

92-
/**
93-
* @ticket 42066
94-
*
95-
* @covers WP_MS_Themes_List_Table::get_views
96-
*/
97-
public function test_get_views_should_return_views_by_default() {
98-
global $totals;
91+
/**
92+
* @ticket 42066
93+
*
94+
* @covers WP_MS_Themes_List_Table::get_views
95+
*/
96+
public function test_get_views_should_return_views_by_default() {
97+
global $totals;
9998

100-
$totals_backup = $totals;
101-
$totals = array(
102-
'all' => 21,
103-
'enabled' => 1,
104-
'disabled' => 2,
105-
'upgrade' => 3,
106-
'broken' => 4,
107-
'auto-update-enabled' => 5,
108-
'auto-update-disabled' => 6,
109-
);
99+
$totals_backup = $totals;
100+
$totals = array(
101+
'all' => 21,
102+
'enabled' => 1,
103+
'disabled' => 2,
104+
'upgrade' => 3,
105+
'broken' => 4,
106+
'auto-update-enabled' => 5,
107+
'auto-update-disabled' => 6,
108+
);
110109

111-
$expected = array(
112-
'all' => '<a href="themes.php?theme_status=all" class="current" aria-current="page">All <span class="count">(21)</span></a>',
113-
'enabled' => '<a href="themes.php?theme_status=enabled">Enabled <span class="count">(1)</span></a>',
114-
'disabled' => '<a href="themes.php?theme_status=disabled">Disabled <span class="count">(2)</span></a>',
115-
'upgrade' => '<a href="themes.php?theme_status=upgrade">Update Available <span class="count">(3)</span></a>',
116-
'broken' => '<a href="themes.php?theme_status=broken">Broken <span class="count">(4)</span></a>',
117-
'auto-update-enabled' => '<a href="themes.php?theme_status=auto-update-enabled">Auto-updates Enabled <span class="count">(5)</span></a>',
118-
'auto-update-disabled' => '<a href="themes.php?theme_status=auto-update-disabled">Auto-updates Disabled <span class="count">(6)</span></a>',
119-
);
110+
$expected = array(
111+
'all' => '<a href="themes.php?theme_status=all" class="current" aria-current="page">All <span class="count">(21)</span></a>',
112+
'enabled' => '<a href="themes.php?theme_status=enabled">Enabled <span class="count">(1)</span></a>',
113+
'disabled' => '<a href="themes.php?theme_status=disabled">Disabled <span class="count">(2)</span></a>',
114+
'upgrade' => '<a href="themes.php?theme_status=upgrade">Update Available <span class="count">(3)</span></a>',
115+
'broken' => '<a href="themes.php?theme_status=broken">Broken <span class="count">(4)</span></a>',
116+
'auto-update-enabled' => '<a href="themes.php?theme_status=auto-update-enabled">Auto-updates Enabled <span class="count">(5)</span></a>',
117+
'auto-update-disabled' => '<a href="themes.php?theme_status=auto-update-disabled">Auto-updates Disabled <span class="count">(6)</span></a>',
118+
);
120119

121-
$actual = $this->table->get_views();
122-
$totals = $totals_backup;
120+
$actual = $this->table->get_views();
121+
$totals = $totals_backup;
123122

124-
$this->assertSame( $expected, $actual );
125-
}
123+
$this->assertSame( $expected, $actual );
126124
}
127-
endif;
125+
}

0 commit comments

Comments
 (0)