Can someone pls tell me how do I cover the following exception case in my PhpUnit test?
$DB->Insert(db query here...);
$lastInsertID = $DB->InsertID();
if (!$lastInsertID) {
throw new Exception('Unable to insert new record');
}
Thanks in advance
you could mock $DB->Insert to return false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With