Creating an HTTP Test
When creating a test function, use the @test
annotation. This will execute when the functional tests run. The test method should contain a description of what the test is attempting to verify and should be in snake case to make it more readable in the terminal.
Function Test Naming Convention:
Tests should be in snake case for readability when the test's name is rendered to the CI. The test name should follow this format:
For example, testing the RotationScheduleController with the method index should be called: clinical_rotations_get_index_returns_200
In instances where the controller has the same name as the module, then the word controller can be used instead of the controller name: clinical_controller_get_index_returns_200
This is to avoid `Clinical` twice in the name
Example:
The method's name has all the information to determine what and how it’s being tested.
To call an endpoint, we need to state what user is requesting the call before we send the request.
If the acted-on user has an ID of 1 (default administrator), then $this->actingAsAdmin()
can be used instead
Last updated