I am working on a CodeIgniter project and have installed PHPUnit to run unit tests. However, when I execute the tests, I encounter the following error for each test, including the example tests provided by PHPUnit:
Error: Call to undefined function CodeIgniter\Test\helper()
Here is an example of the error message:
There was 1 error:
Error: Call to undefined function CodeIgniter\Test\helper()
C:\xampp\htdocs\moduloNoticias\vendor\codeigniter4\framework\system\Test\CIUnitTestCase.php:234
I have followed the standard installation procedure for PHPUnit in a CodeIgniter project. I have also ensured that PHPUnit is properly installed and configured.
What I have tried:
Is there any additional configuration I need to perform, or is there something I might be missing that could cause this error? Any guidance would be greatly appreciated.
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
change the boostrap path above in your "phpunit.xml.dist", the one located at the root of your project. That's what fixed my issue, for some reasons the healthTest.php does not work out of the box. in my case test that I wrote worked but I could never figure out why the healthiest was always failing.