Welcome Guest, Not a member yet? Register   Sign In
Any tutorials on Unit testing in CI4?

(This post was last modified: 05-05-2022, 12:44 PM by dgvirtual.)

I would like to do some testing before deploying the app updates to the server, some CLI script that would run my controllers with the standard data and make sure there are no critical errors, so users do not see the "oops..." page quite so often Smile I imagine I need to write unit tests for that.
I have never done unit testing and the content in Codeigniter 4 documentation seems to be written for those who know what it is pretty well and only need some hints on doing it the CI4 way.
Could someone point me in the right direction? Easiest would be to find some simple tutorial about unit-testing controllers in CI, but in case there are none - how would you proceed to make learning PHP unit testing and writing tests the CI4 way as painless and short as possible?

Donatas G.

(This post was last modified: 05-05-2022, 11:48 PM by captain-sensible. Edit Reason: added text )

well here's a birds eye view : https://www.guru99.com/unit-testing-guide.html

I use Arch Linux by the way 

CMS in Action

(05-05-2022, 11:46 PM)captain-sensible Wrote: well here's a birds eye view : https://www.guru99.com/unit-testing-guide.html



Donatas G.

PHPUnit: What, Why, How? | Andy Carter

We are eventually going to have all the unit tests running in engine, so zero 'command line' config, and where you can select which files to run via a user friendly dropdown.

Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com

PHP Unit Testing - PHPUnit Tutorial - Full PHP 8 Tutorial - YouTube

Guys i need help here on Php Spark serve

PS C:\xampp\htdocs\project> php spark serve

CodeIgniter v4.1.9 Command Line Tool - Server Time: 2022-05-10 05:36:38 UTC-05:00

CodeIgniter development server started on http://localhost:8080
Press Control-C to stop.

PS C:\xampp\htdocs\project>

The problem here is that , it loads the server but it automatically cancel by itself and server will stop working

Thanks guys, good resources, enough to read and learn!

Donatas G.

Great resources listed already! Also make sure you read the framework’s “testing quick start” docs if you haven’t already: https://github.com/codeigniter4/CodeIgni.../README.md

These are geared towards working in the framework itself but should help with some of the CodeIgniter-specific stuff.

Unit testing with PHPUnit: Introduction (1/10) - YouTube

Theme © iAndrew 2016 - Forum software by © MyBB