/** * Fetches the statuses of the circuit boards from the database. * @throws Exception If a query fails to execute. */ public function fetchStatuses() { $database = new DatabaseWrapper(); $database->connect(DB_NAME); $boards = $database->queryAllBoardInformation(); foreach ($boards as $board) { $msisdn = $board->getMSISDN(); $status = null; try { $status = $database->queryBoardStatus($msisdn); } catch (Exception $e) { /* failed to find its status */ } $this->model->addBoard(new CircuitBoard($board, $status)); } }
function testQueryAllBoardInformation() { $result = $this->db->queryAllBoardInformation(); $this->assertTrue(count($result) == 2); }