Unit testing issue |
I'm exploring unit testing with CI4 and have run into a problem. I can test controllers without problem but any attempt to test a model or the database throws an 'headers already sent by (output started at /var/vendor/phpunit/phpunit/src/Util/Printer.php'.
I've done some digging and nothing I've found online seems applicable. I'm using the \CIDatabaseTestCase as descrideb in https://codeigniter4.github.io/userguide...abase.html, and nothing seems to be working. Any ideas?
The actual code I'm running, if it helps:
PHP Code: namespace App\Models;
What version of the framework are both of you using? Are you running just the test in question, or a suite that includes this one? How are you bootstrapping your tests?
If you haven’t already I highly recommend checking out codeigniter4projects/ProjectTests and ModuleTests for unit testing with the framework. (01-29-2020, 06:02 PM)MGatner Wrote: What version of the framework are both of you using? Are you running just the test in question, or a suite that includes this one? How are you bootstrapping your tests? For me, I'm using 4.0.0-rc.3 and yes, that is the only test I'm running right now. Bootstrapping-wise I'm using the default phpunit.xml.dist unless I made a change I've forgotten about. I'll check again first thing tomorrow and post here if I've updated. Thanks for the pointers - I'd not seen the link to the projects repository in the user guide source installation directory repositories file. I'll definitely check those out! (01-29-2020, 06:02 PM)MGatner Wrote: What version of the framework are both of you using? Are you running just the test in question, or a suite that includes this one? How are you bootstrapping your tests? 4.0.0-rc.3 I am tryint test my controllers with featuretest. (01-29-2020, 06:02 PM)MGatner Wrote: If you haven’t already I highly recommend checking out codeigniter4projects/ProjectTests and ModuleTests for unit testing with the framework.Thanks for the pointer - I pulled down the repo and looked through it and I've get everything up and running now! I appreciate the help. |
Welcome Guest, Not a member yet? Register Sign In |