SearchDashboard: rename ::load() to ::search()
Function signature didn't match parent factory function fixes #7081
This commit is contained in:
parent
0f8d5bddba
commit
0f7f2f2d8b
|
@ -13,7 +13,7 @@ class SearchController extends ActionController
|
||||||
{
|
{
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->view->dashboard = SearchDashboard::load($this->params->get('q'));
|
$this->view->dashboard = SearchDashboard::search($this->params->get('q'));
|
||||||
|
|
||||||
// NOTE: This renders the dashboard twice. Remove this once we can catch exceptions thrown in view scripts.
|
// NOTE: This renders the dashboard twice. Remove this once we can catch exceptions thrown in view scripts.
|
||||||
$this->view->dashboard->render();
|
$this->view->dashboard->render();
|
||||||
|
|
|
@ -12,7 +12,7 @@ if (! $this->auth()->isAuthenticated()) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div id="menu" data-base-target="_main">
|
<div id="menu" data-base-target="_main">
|
||||||
<? if (SearchDashboard::load('dummy')->getPane('search')->hasComponents()): ?>
|
<? if (SearchDashboard::search('dummy')->getPane('search')->hasComponents()): ?>
|
||||||
<form action="<?= $this->href('search') ?>" method="get" role="search">
|
<form action="<?= $this->href('search') ?>" method="get" role="search">
|
||||||
<input type="text" name="q" class="search autofocus" placeholder="<?= $this->translate('Search...') ?>" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
<input type="text" name="q" class="search autofocus" placeholder="<?= $this->translate('Search...') ?>" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -32,7 +32,7 @@ class SearchDashboard extends Dashboard
|
||||||
* @param $searchQuery
|
* @param $searchQuery
|
||||||
* @return Dashboard|SearchDashboard
|
* @return Dashboard|SearchDashboard
|
||||||
*/
|
*/
|
||||||
public static function load($searchQuery = '')
|
public static function search($searchQuery = '')
|
||||||
{
|
{
|
||||||
/** @var $dashboard SearchDashboard */
|
/** @var $dashboard SearchDashboard */
|
||||||
$dashboard = new static('searchDashboard');
|
$dashboard = new static('searchDashboard');
|
||||||
|
|
|
@ -48,27 +48,27 @@ class SearchDashboardTest extends BaseTestCase
|
||||||
*/
|
*/
|
||||||
public function testFoo()
|
public function testFoo()
|
||||||
{
|
{
|
||||||
$dashboard = SearchDashboard::load('pending');
|
$dashboard = SearchDashboard::search('pending');
|
||||||
$dashboard->getPane('search')->removeComponents();
|
$dashboard->getPane('search')->removeComponents();
|
||||||
$dashboard->render();
|
$dashboard->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWhetherLoadLoadsSearchDashletsFromModules()
|
public function testWhetherLoadLoadsSearchDashletsFromModules()
|
||||||
{
|
{
|
||||||
$dashboard = SearchDashboard::load('pending');
|
$dashboard = SearchDashboard::search('pending');
|
||||||
|
|
||||||
$result = $dashboard->getPane('search')->hasComponent('Hosts: pending');
|
$result = $dashboard->getPane('search')->hasComponent('Hosts: pending');
|
||||||
|
|
||||||
$this->assertTrue($result, 'Dashboard::load() could not load search dashlets from modules');
|
$this->assertTrue($result, 'Dashboard::search() could not load search dashlets from modules');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testWhetherLoadProvidesHint()
|
public function testWhetherLoadProvidesHint()
|
||||||
{
|
{
|
||||||
$dashboard = SearchDashboard::load('');
|
$dashboard = SearchDashboard::search('');
|
||||||
|
|
||||||
$result = $dashboard->getPane('search')->hasComponent('Ready to search');
|
$result = $dashboard->getPane('search')->hasComponent('Ready to search');
|
||||||
|
|
||||||
$this->assertTrue($result, 'Dashboard::load() could not get hint for search');
|
$this->assertTrue($result, 'Dashboard::search() could not get hint for search');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue