Fix tests for pagination in controller

refs #4611
This commit is contained in:
Jannis Moßhammer 2013-09-12 17:37:46 +02:00
parent 376dc8cd0f
commit 4206504c9c
2 changed files with 7 additions and 4 deletions

View File

@ -67,10 +67,11 @@ class ListControllerHostMySQLTest extends MonitoringControllerTest
}
$controller = $this->requireController('ListController', $backend);
$controller->hostsAction();
$result = $controller->view->hosts->fetchAll();
$result = $controller->view->hosts;
$this->assertCount(5, $result, 'Testing correct result count for '.$backend);
$this->assertEquals(5, $result->getTotalItemCount(), 'Testing correct result count for '.$backend);
$result = $result->getAdapter()->getItems(0,6);
for($i=1;$i<=5;$i++) {
$this->assertEquals('host'.$i, $result[$i-1]->host_name, "Asserting correct host names for backend ".$backend);
}

View File

@ -56,9 +56,11 @@ class ListControllerServiceMySQLTest extends MonitoringControllerTest
$controller = $this->requireController('ListController', $backend);
$controller->servicesAction();
$result = $controller->view->services->fetchAll();
$this->assertEquals(9, count($result), "Testing for correct service count");
$result = $controller->view->services;
$this->assertEquals(9, $result->getTotalItemCount(), "Testing for correct service count");
$result = $result->getAdapter()->getItems(0,1);
$this->assertEquals("notes.url", $result[0]->service_notes_url, "Testing for correct notes_url");
$this->assertEquals("action.url", $result[0]->service_action_url, "Testing for correct action_url");
$this->assertEquals(0, $result[0]->service_state, "Testing for correct Service state");