From bfa7320d85130d92c9ca8758b1fe2b0bb67e4d79 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 20 Nov 2014 12:48:05 +0100 Subject: [PATCH] Dashboard: Fix tests refs #7751 --- .../Icinga/Web/Widget/DashboardTest.php | 50 +++++++++---------- .../Icinga/Web/Widget/SearchDashboardTest.php | 8 +-- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/test/php/library/Icinga/Web/Widget/DashboardTest.php b/test/php/library/Icinga/Web/Widget/DashboardTest.php index 21727480b..2aa2bdcf4 100644 --- a/test/php/library/Icinga/Web/Widget/DashboardTest.php +++ b/test/php/library/Icinga/Web/Widget/DashboardTest.php @@ -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' ); } diff --git a/test/php/library/Icinga/Web/Widget/SearchDashboardTest.php b/test/php/library/Icinga/Web/Widget/SearchDashboardTest.php index d9323c00a..5e6e1cc69 100644 --- a/test/php/library/Icinga/Web/Widget/SearchDashboardTest.php +++ b/test/php/library/Icinga/Web/Widget/SearchDashboardTest.php @@ -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'); }