Unit testing issue - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Unit testing issue (/showthread.php?tid=75329) |
Unit testing issue - maxxd - 01-27-2020 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/testing/database.html, and nothing seems to be working. Any ideas? RE: Unit testing issue - maxxd - 01-28-2020 The actual code I'm running, if it helps: PHP Code: namespace App\Models; RE: Unit testing issue - hatsat32 - 01-28-2020 I have same error in featuretest but cant find any solution RE: Unit testing issue - MGatner - 01-29-2020 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. RE: Unit testing issue - maxxd - 01-29-2020 (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! RE: Unit testing issue - hatsat32 - 01-31-2020 (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. RE: Unit testing issue - maxxd - 02-09-2020 (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. |