[icinga-checkins] icinga.org: icingaweb2/feature/security-gui-5647: Dashboard: Fix tests

git at icinga.org git at icinga.org
Thu Nov 20 16:13:02 CET 2014


Module: icingaweb2
Branch: feature/security-gui-5647
Commit: bfa7320d85130d92c9ca8758b1fe2b0bb67e4d79
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=bfa7320d85130d92c9ca8758b1fe2b0bb67e4d79

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Nov 20 12:48:05 2014 +0100

Dashboard: Fix tests

refs #7751

---

 .../library/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 2172748..2aa2bdc 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 d9323c0..5e6e1cc 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');
     }



More information about the icinga-checkins mailing list