I am very much in doubt about unit testing the controllers that I create in Laravel, such as: employeeController, where it has methods such as index, store, edit. Does anyone know how I should perform these tests on the controller methods?
I am very much in doubt about unit testing the controllers that I create in Laravel, such as: employeeController, where it has methods such as index, store, edit. Does anyone know how I should perform these tests on the controller methods?
To see these functions that Laravel provides you use the command when creating your controller:
and your routes file
Responding to your comment
In your
composer.json
you must include:then you run from the terminal stopped in your project
Composer update
from console you see that everything is fine
vendor/bin/phpunit
Then in you create a file for tests in
App/prueba.php
we create a function
You run the command again:
and in your routes file:
and again:
Similarly we have the official documentation of Laravel.
Laravel Docs