I have a question, lets say i have a small API, and one of API controllers do something like this:
<?php
class UserController extends \Phalcon\Mvc\Controller {
public function indexAction() {
$user = new User();
$user->name = 'User';
$user->email = '[email protected]';
if (!$user->create()) {
// Here may be some other logic for user save fail
thow new \Exception('User create error');
}
}
}
How can i mock user instance to test logic of user creation fail
?