A test is a small program that runs your code with known inputs and checks the result. This section builds a test suite for the bookshop classes of the earlier sections (Money, Product, Order, OutOfStockException and the repository of Subsection 4.16.15) with PHPUnit 13 79,198 , PHP's standard testing framework, plus Pest, Mockery 10,724 and Infection 2,244 . Laravel 2,157 's testing helpers are Testing and Deployment.
Subsections
- Why Tests Pay for Themselves
- Setting Up PHPUnit
- Your First Test Case
- Assertions Worth Knowing
- Fixtures, setUp and tearDown
- Data Providers
- Testing Exceptions and Errors
- Stubs and Mocks
- Mockery and Hand-Written Fakes
- Testable Code
- Time and File System
- Database Tests
- HTTP Handler Tests
- Code Coverage
- CI and Mutation Testing