Angga Ari Wijaya
Angga Ari Wijaya
I want to keep the DML (insert, edit delete) method, only mocking result of `$this->db->trans_status()`, when I try to follow the example, insert, edit, delete error, but I'm managed to...
I want to test how my application can react (catch) against database failure, in my controller I do many database operation such as inserts and updates using transaction. I want...
I replace the code bellow: ```php //MonkeyPatch::patchMethod('CI_DB_driver', ['trans_status' => false]); $this->request->addCallable(function ($CI) { $db = $this->getMockBuilder('CI_DB_driver')->disableOriginalConstructor()->getMock(); $db->method('trans_status')->willReturn(false); $CI->db = $db; }); ``` and result error `Error: Call to undefined method...
I already tried before, I'm using mysqli then result another error `Error: Call to a member function from() on null`
I don't call any database operation from test, error come from the controller which I called from $this->request because the I mock the $db. The message lack of information, which...
the controller call method from model that selecting data from database ```php public function inactive($id) { // this line is error in test, it says error call select() on null...
setMethods() is deprecated but I already add setMethods()/onlyMethods() and the error still same. In my test using database transaction to rollback data after request, is this caused the error? ```php...
I use the example of your project [ci-app-for-ci-phpunit-test](https://github.com/kenjis/ci-app-for-ci-phpunit-test), in other framework that I used to, they have capability to rollback out of the box, no need manually setup. In this...
> You need a partial mock which can access the database. exactly, I just want to mock the trans_status() to return false, any functionality to database still same Ah I...
I found the solution but not totally perfect, due to mocked db that passed into the request is different object with db in test case that used for rollback the...