function testQueryBoardInformation() { $expected = new CircuitBoardInformation(12345, 'testboard'); $result = $this->db->queryBoardInformation(12345); $this->assertIdentical($expected, $result); $this->assertException('FetchStatementException', [$this->db, 'queryBoardInformation'], [1122]); }
/** * Fetches the statuses of the circuit boards from the database. * @throws Exception If a query fails to execute. */ public function fetchUpdates() { $soap = new SoapClientWrapper(); $messages = $soap->getNewMessages(); $database = new DatabaseWrapper(); $database->connect(DB_NAME); foreach ($messages as $message) { $xmlParser = new XMLParser($message); $xmlParser->parse(); $parsedMessage = $xmlParser->getParsedData(); $validator = new SMSValidator($parsedMessage); try { $msisdn = $validator->validateMSISDN(); $status = $validator->validateStatus(); $information = $database->queryBoardInformation($msisdn); $update = new CircuitBoard($information, $status); $database->updateBoardStatus($msisdn, $status); $this->model->addUpdate($update); } catch (Exception $e) { continue; } } }