wordpress-develop/tests/phpunit/tests/admin/wpThemeInstallListTable.php
David Baumwald 56bde67811 Administration: Add new get_views_links method to WP_List_Table.
Many `WP_List_Table` child classes in core use mostly the same code to create their "view" links markup.  To DRY-up the code, a new `WP_List_Table->get_view_links` method is being introduced to consolidate the HTML link generation when provided an array of links.

This change also implements this new method in the relevant `WP_List_Table_xxx` child classes `get_views` methods.  Finally, unit tests are being added to validate view links markup and test for some "unhappy paths".

Props afercia, costdev, garrett-eclipse, Dharm1025, juhise, peterwilsoncc.
Fixes #42066.

git-svn-id: https://develop.svn.wordpress.org/trunk@54215 602fd350-edb4-49c9-b593-d223f7449a82
2022-09-19 21:06:08 +00:00

28 lines
587 B
PHP

<?php
/**
* @group admin
*
* @covers WP_Theme_Install_List_Table
*/
class Tests_Admin_wpThemeInstallListTable extends WP_UnitTestCase {
/**
* @var WP_Theme_Install_List_Table
*/
public $table = false;
public function set_up() {
parent::set_up();
$this->table = _get_list_table( 'WP_Theme_Install_List_Table', array( 'screen' => 'theme-install' ) );
}
/**
* @ticket 42066
*
* @covers WP_Theme_Install_List_Table::get_views
*/
public function test_get_views_should_return_no_views_by_default() {
$this->assertSame( array(), $this->table->get_views() );
}
}