Knowledgebase

Testing Laravel Applications Print

  • phplaravel, database, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Automated verification.

WHAT THE FRAMEWORK PROVIDES

A testing setup, a separate testing database configuration, and helpers for simulating requests.

WHAT TO TEST FIRST

The paths that matter most Anything involving money Anything that has broken before Authorisation

THAT LAST ONE

Testing that a user cannot reach another user's record is among the highest-value tests you can write.

WHAT KINDS OF TEST EXIST

Testing a class in isolation Testing a request end to end

WHAT TO PREFER FOR A SMALL APPLICATION

Request-level tests, which cover more per test.

WHAT TO USE FOR TEST DATA

Factories, generating records on demand.

WHAT TO CONFIGURE

A separate database, refreshed between tests.

WHAT TO NEVER DO

Run tests against production data.

WHAT TO ASSERT

The response status What changed in the database What was sent or queued

WHAT TO FAKE

Mail, queues and external services, so tests do not send or call anything.

WHEN TO RUN THEM

Before every deployment.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot