Technical Mid Level

Describe your approach to testing PHP applications with PHPUnit. How do you decide what to unit test versus integration test?

Quick Tip

Be specific: "I unit test service classes with mocked repositories, integration test repositories against a real test database, and use data providers for edge cases."

What good answers include

Strong answers describe a testing pyramid: many unit tests for business logic, fewer integration tests for database/API interactions, and minimal end-to-end tests. Candidates should mention mocking dependencies, test databases, data providers, and code coverage as a guide (not a target). Best answers discuss testing strategies for specific patterns like repositories, services, and controllers.

What interviewers are looking for

Tests professional development practices. Developers without testing experience or who only write trivial tests are a risk for code quality. Ask about a bug they caught through testing.

← All PHP questions