Welcome Guest, Not a member yet? Register   Sign In
How to test a controller with PHPUnit in Codeigniter 4?
#1
Question 

Hello friends, I hope you are having a great day.
I am new to learning CI4 and also PHPUnit, I was searching the internet on how to implement PHPUnit in a CI4 project, but I did not find any clear information, I went through the following documentation and tutorials to get started:

https://codeigniter4.github.io/userguide...rview.html
https://www.youtube.com/watch?v=9-X_b_fx...ramWithGio
https://www.youtube.com/@ProgramWithGio "testing phpunit"
https://github.com/kenjis/ci-phpunit-tes...ontrollers

However, I found that testing in CI4 is different, it makes use of classes and I didn't find examples on how it is implemented.
I ask for help if someone can guide me with a simple example of how the test structure of a controller that returns a view or returns true should be.
Reply
#2

Testing controllers is the one of most difficult things in testing.
See https://codeigniter4.github.io/CodeIgnit...ature.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB