php - Test exception in CodeIgniter using PHPUnit/CIUnit -
i have method in person_model.php:
public function getinfo() { $result = array(); try { // } catch(exception $exception) { log_message('error', $exception->getmessage()); } { return $result; } }
and how can test exception , make sure log_message() method called when exception caught ?
thanks !!!
it can't done easily, because there isn't way mock call log_message. code above however, may able test return value or might change if exception thrown. example, let's if exception thrown, , can sure in case returned value empty array. example, test count of return 0.
Comments
Post a Comment