table = _get_list_table( 'WP_MS_Themes_List_Table', array( 'screen' => 'ms-themes' ) );
}
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/',
),
'wordpress.org/afoo/' => array(
'domain' => 'wordpress.org',
'path' => '/afoo/',
),
'make.wordpress.org/' => array(
'domain' => 'make.wordpress.org',
'path' => '/',
),
'make.wordpress.org/foo/' => array(
'domain' => 'make.wordpress.org',
'path' => '/foo/',
),
'www.w.org/' => array(
'domain' => 'www.w.org',
'path' => '/',
),
'www.w.org/foo/' => array(
'domain' => 'www.w.org',
'path' => '/foo/',
),
'www.w.org/foo/bar/' => array(
'domain' => 'www.w.org',
'path' => '/foo/bar/',
),
'test.example.org/' => array(
'domain' => 'test.example.org',
'path' => '/',
),
'test2.example.org/' => array(
'domain' => 'test2.example.org',
'path' => '/',
),
'test3.example.org/zig/' => array(
'domain' => 'test3.example.org',
'path' => '/zig/',
),
'atest.example.org/' => array(
'domain' => 'atest.example.org',
'path' => '/',
),
);
foreach ( self::$site_ids as &$id ) {
$id = $factory->blog->create( $id );
}
unset( $id );
}
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $site_id ) {
wp_delete_site( $site_id );
}
}
/**
* @ticket 42066
*
* @covers WP_MS_Themes_List_Table::get_views
*/
public function test_get_views_should_return_views_by_default() {
global $totals;
$totals_backup = $totals;
$totals = array(
'all' => 21,
'enabled' => 1,
'disabled' => 2,
'upgrade' => 3,
'broken' => 4,
'auto-update-enabled' => 5,
'auto-update-disabled' => 6,
);
$expected = array(
'all' => 'All (21)',
'enabled' => 'Enabled (1)',
'disabled' => 'Disabled (2)',
'upgrade' => 'Update Available (3)',
'broken' => 'Broken (4)',
'auto-update-enabled' => 'Auto-updates Enabled (5)',
'auto-update-disabled' => 'Auto-updates Disabled (6)',
);
$actual = $this->table->get_views();
$totals = $totals_backup;
$this->assertSame( $expected, $actual );
}
}