GET Requests
GET Request:
When calling a get
method, two pieces of information are required:
The URL (This could also contain the query parameters)
The authentication token
Example:
/**
* Test that the GET /events returns 200
*
* @test
* @return void
*/
public function events_get_method_index_returns_200(): void
{
$this->actingAsAdmin()
->authenticate()
->get('/events');
}
The URL in this example is /events
Use the method ->authenticate()
to authenticate the user, so the token does not have to be passed in the request.
Example 2:
$this->actingAs(User::find(6))
->authenticate()
->get('/assessments/assessment-methods?course_id=2')
The value for “course_id” is 2 within the URL
Last updated