parent
d018b4c2ae
commit
bfa7320d85
|
@ -12,10 +12,10 @@ use Mockery;
|
|||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Widget\Dashboard;
|
||||
use Icinga\Web\Widget\Dashboard\Pane;
|
||||
use Icinga\Web\Widget\Dashboard\Component;
|
||||
use Icinga\Web\Widget\Dashboard\Dashlet;
|
||||
use Icinga\Test\BaseTestCase;
|
||||
|
||||
class ComponentWithMockedView extends Component
|
||||
class DashletWithMockedView extends Dashlet
|
||||
{
|
||||
public function view()
|
||||
{
|
||||
|
@ -156,14 +156,14 @@ class DashboardTest extends BaseTestCase
|
|||
/**
|
||||
* @depends testWhetherGetPaneReturnsAPaneByName
|
||||
*/
|
||||
public function testWhetherRenderNotRendersPanesDisabledComponent()
|
||||
public function testWhetherRenderNotRendersPanesDisabledDashlet()
|
||||
{
|
||||
$dashboard = new Dashboard();
|
||||
$dashboard->createPane('test1');
|
||||
$pane = $dashboard->getPane('test1');
|
||||
$component = new ComponentWithMockedView('test', 'test', $pane);
|
||||
$component->setDisabled(true);
|
||||
$pane->addComponent($component);
|
||||
$dashlet = new DashletWithMockedView('test', 'test', $pane);
|
||||
$dashlet->setDisabled(true);
|
||||
$pane->addDashlet($dashlet);
|
||||
|
||||
$rendered = $dashboard->render();
|
||||
|
||||
|
@ -171,20 +171,20 @@ class DashboardTest extends BaseTestCase
|
|||
|
||||
$this->assertFalse(
|
||||
$greaterThanOne,
|
||||
'Dashboard::render() disabled component is rendered, but should not'
|
||||
'Dashboard::render() disabled dashlet is rendered, but should not'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherGetPaneReturnsAPaneByName
|
||||
*/
|
||||
public function testWhetherRenderRendersPanesEnabledComponent()
|
||||
public function testWhetherRenderRendersPanesEnabledDashlet()
|
||||
{
|
||||
$dashboard = new Dashboard();
|
||||
$dashboard->createPane('test1');
|
||||
$pane = $dashboard->getPane('test1');
|
||||
$component = new ComponentWithMockedView('test', 'test', $pane);
|
||||
$pane->addComponent($component);
|
||||
$dashlet = new DashletWithMockedView('test', 'test', $pane);
|
||||
$pane->addDashlet($dashlet);
|
||||
|
||||
$rendered = $dashboard->render();
|
||||
|
||||
|
@ -192,7 +192,7 @@ class DashboardTest extends BaseTestCase
|
|||
|
||||
$this->assertTrue(
|
||||
$greaterThanOne,
|
||||
'Dashboard::render() could not render enabled component'
|
||||
'Dashboard::render() could not render enabled dashlet'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -259,44 +259,44 @@ class DashboardTest extends BaseTestCase
|
|||
/**
|
||||
* @depends testWhetherGetPaneReturnsAPaneByName
|
||||
*/
|
||||
public function testWhetherRemoveComponentRemovesComponent()
|
||||
public function testWhetherRemoveDashletRemovesDashlet()
|
||||
{
|
||||
$dashboard = new Dashboard();
|
||||
$dashboard->createPane('test1');
|
||||
$pane = $dashboard->getPane('test1');
|
||||
|
||||
$component = new Component('test', 'test', $pane);
|
||||
$pane->addComponent($component);
|
||||
$dashlet = new Dashlet('test', 'test', $pane);
|
||||
$pane->addDashlet($dashlet);
|
||||
|
||||
$component2 = new Component('test2', 'test2', $pane);
|
||||
$pane->addComponent($component2);
|
||||
$dashlet2 = new Dashlet('test2', 'test2', $pane);
|
||||
$pane->addDashlet($dashlet2);
|
||||
|
||||
$dashboard->getPane('test1')->removeComponent('test');
|
||||
$result = $dashboard->getPane('test1')->hasComponent('test');
|
||||
$dashboard->getPane('test1')->removeDashlet('test');
|
||||
$result = $dashboard->getPane('test1')->hasDashlet('test');
|
||||
|
||||
$this->assertTrue(
|
||||
$result,
|
||||
'Dashboard::removeComponent() could not remove component from the pane'
|
||||
'Dashboard::removeDashlet() could not remove dashlet from the pane'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testWhetherGetPaneReturnsAPaneByName
|
||||
*/
|
||||
public function testWhetherSetComponentUrlUpdatesTheComponentUrl()
|
||||
public function testWhetherSetDashletUrlUpdatesTheDashletUrl()
|
||||
{
|
||||
$dashboard = new Dashboard();
|
||||
$dashboard->createPane('test1');
|
||||
$pane = $dashboard->getPane('test1');
|
||||
$component = new Component('test', 'test', $pane);
|
||||
$pane->addComponent($component);
|
||||
$dashlet = new Dashlet('test', 'test', $pane);
|
||||
$pane->addDashlet($dashlet);
|
||||
|
||||
$dashboard->getPane('test1')->getComponent('test')->setUrl('new');
|
||||
$dashboard->getPane('test1')->getDashlet('test')->setUrl('new');
|
||||
|
||||
$this->assertEquals(
|
||||
'new',
|
||||
$component->getUrl()->getPath(),
|
||||
'Dashboard::setComponentUrl() could not return valid expectation'
|
||||
$dashlet->getUrl()->getPath(),
|
||||
'Dashboard::setDashletUrl() could not return valid expectation'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ class SearchDashboardTest extends BaseTestCase
|
|||
/**
|
||||
* @expectedException Zend_Controller_Action_Exception
|
||||
*/
|
||||
public function testWhetherRenderThrowsAnExceptionWhenHasNoComponents()
|
||||
public function testWhetherRenderThrowsAnExceptionWhenHasNoDashlets()
|
||||
{
|
||||
$dashboard = SearchDashboard::search('pending');
|
||||
$dashboard->getPane('search')->removeComponents();
|
||||
$dashboard->getPane('search')->removeDashlets();
|
||||
$dashboard->render();
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class SearchDashboardTest extends BaseTestCase
|
|||
{
|
||||
$dashboard = SearchDashboard::search('pending');
|
||||
|
||||
$result = $dashboard->getPane('search')->hasComponent('Hosts: pending');
|
||||
$result = $dashboard->getPane('search')->hasDashlet('Hosts: pending');
|
||||
|
||||
$this->assertTrue($result, 'Dashboard::search() could not load search dashlets from modules');
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class SearchDashboardTest extends BaseTestCase
|
|||
{
|
||||
$dashboard = SearchDashboard::search();
|
||||
|
||||
$result = $dashboard->getPane('search')->hasComponent('Ready to search');
|
||||
$result = $dashboard->getPane('search')->hasDashlet('Ready to search');
|
||||
|
||||
$this->assertTrue($result, 'Dashboard::search() could not get hint for search');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue