So i am giving a sample of my controller and web.php file. controller { public function add() { //Method called via web.php } public function multiply() { //how to access this while testing } }
web.php
route::get('/add','controller@add');
And now if i want to perform unit testing
case1:
add
$response = $this->get(route('add'));
Now it will send a get request when /add is accessed and controller method add will be accessed. And then i can use various assertions to check its functionality.
case2:
multiply
Here there isnt any route specified, so it wont be able to access controller method.
How can i test my multiply method in such a case
Aucun commentaire:
Enregistrer un commentaire