Hello folks, I want to start writing tests for my applications . I Just watched couple of tutorials . My questions might be silly so pardon me.
There they are declaring $response variable and assigning value as follows :
$response = $this->get(route('auth.login'));
what are $response and $this variables in this context ? what they refers to ?
$this refers to the test and the class it extends (laravels test case). $response is just that. A response class with alot of helpers to test the state of the given response.
In theory you should be able to just chain it, but part of testing is breaking it up. It usually have 3 parts
Arrange
Act
Assert
So here calling the endpoint is 2 and asserting is a seperate action, 3.