kenjis

Results 995 comments of kenjis

To what did you call `from()`? Inspect it, please. Error messages tells you what is wrong.

> The stack trace pointing wrong line number of code, when I checked the line it is pointing the comment or the code that I never test. It is because...

> this is what I meant in first question above, why $db in model become null? `$db` in model? What do you mean? Not in controller? And not `$db` but...

Why don't you mock `$this->training`, too? Ah, you probably forget calling `setMethods()`/`onlyMethods()`? https://github.com/kenjis/ci-phpunit-test/issues/384#issuecomment-926348831

You inject the real db object in your `setup()` and use it to rollback in `tearDown()`. It means you use the *real* db connection, and read/write db, and after testing...

> In my test using database transaction to rollback data after request, is this caused the error? Maybe no. The *db* object in the `setUp()` and the mock db object...

> setMethods() is deprecated but I already add setMethods()/onlyMethods() and the error still same. Use `onlyMethods()`. Any way, all you to do is to fix the db mock not to...

> In this one I just copy from the example code, is it wrong with that? The test code is not wrong, because all the tests pass in the repository....

You can write like this with [getDouble()](https://github.com/kenjis/ci-phpunit-test/blob/3.x/docs/FunctionAndClassReference.md#testcasegetdoubleclassname-params-constructor_params--false): ```php $db['test'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'username', 'password' => 'password', 'database' => 'codeigniter', 'dbdriver' => 'mysqli', 'dbprefix'...