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

(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.
Reply
#2

(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


https://phpunit.de/getting-started/phpunit-9.html
CMS CI4     I use Arch Linux by the way 

Reply
#3

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


https://phpunit.de/getting-started/phpunit-9.html

Thanks!
==

Donatas G.
Reply
#4

PHPUnit: What, Why, How? | Andy Carter
https://andy-carter.com/blog/phpunit-what-why-how
Reply
#5

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.

https://www.ignitedcms.com/playground/unit-testing
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#6

PHP Unit Testing - PHPUnit Tutorial - Full PHP 8 Tutorial - YouTube
https://www.youtube.com/watch?v=9-X_b_fxmRM
Reply
#7

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
Reply
#8

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

Donatas G.
Reply
#9

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.
Reply
#10

Unit testing with PHPUnit: Introduction (1/10) - YouTube
https://www.youtube.com/watch?v=k9ak_rv9...bD47-_d8bJ
Reply




Theme © iAndrew 2016 - Forum software by © MyBB