GET Requests

GET Request:

When calling a get method, two pieces of information are required:

  1. The URL (This could also contain the query parameters)

  2. The authentication token


 * Test that the GET /events returns 200
 * @test
 * @return void
public function events_get_method_index_returns_200(): void

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:


The value for “course_id” is 2 within the URL

The test does not call $this->actingAsAdmin() because the user in the test is not user 1 (default administrator)

Last updated