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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -