Cmd/Ctrl + K

HTTP tests

Use InteractsWithApplication to issue requests against the application.

Assertions are provided by the framework test response wrapper.

JSON requests

Use the JSON helper to encode request data and set the appropriate request headers.

JSON requests automatically send Accept: application/json and Content-Type: application/json.

Available assertions

Test responses provide assertions for status codes, headers, content, and JSON data.

Available response helpers include:

  • status()
  • content()
  • json($key = null, $default = null)
  • baseResponse()
  • assertStatus()
  • assertOk()
  • assertCreated()
  • assertNoContent()
  • assertRedirect()
  • assertHeader()
  • assertSee()
  • assertDontSee()
  • assertJson()
  • assertJsonPath()

Acting as a user

Authenticate the test client when exercising routes protected by auth middleware.

The user must implement Codemonster\Auth\Contracts\AuthenticatableInterface.