kenjis

Results 502 comments of kenjis

@Gregwar It would be great if this library works on PHP 8.1.

At least, CodeIgniter sparks is not compatible with CodeIgniter 3.0. But this project is still alive and you can use it with CodeIgniter 2.x. Right?

You are the first person who requested updates for PHP 8.1. Yes, `3.x` branch supports PHP 8.1. Do you have no problem at all?

Can you show a minimum sample code to modify $class $method variables ? Or please send a PR to https://github.com/kenjis/ci-app-for-ci-phpunit-test

If you believe CodeIgniter's database library works fine, I recommend you use mock. See how to mock `$this->db`: https://github.com/kenjis/ci-app-for-ci-phpunit-test/blob/v3.0.0/application/tests/models/Category_model_mocking_db_test.php Mock the all methods you use in your controller, and inject...

I don't recommend you use monkey patch. It's dirty solution for legacy code. What do you want to test? CodeIgniter code? DBMS? or your app code? When you use the...

Call `setMethods()` with the method names you want to mock. ```php $mock = $this->getMockBuilder(stdClass::class) ->setMethods(['set']) ->getMock(); ``` See https://phpunit.readthedocs.io/en/8.5/test-doubles.html If you use PHPUnit 9, use `onlyMethods()` instead. See https://phpunit.readthedocs.io/en/9.5/test-doubles.html

You could use `$this->getDouble()` short cut method that ci-phpunit-test provides. See https://github.com/kenjis/ci-phpunit-test/blob/3.x/docs/FunctionAndClassReference.md#testcasegetdoubleclassname-params-constructor_params--false

`CI_DB_driver` does not have `select()`. Mock the real class you actually use. If you use `mysqli` driver: ```php $this->request->addCallable(function ($CI) { $db = $this->getMockBuilder('CI_DB_mysqli_driver')->disableOriginalConstructor()->getMock(); $db->method('trans_status')->willReturn(false); $CI->db = $db; }); ```