~/talk

Testing APIs written in PHP using the Behat feature testing tool

Talkat phpday 2025 · 2025-05-15..05-16· [php, testing]
slides:none on file

Uses Behat and Gherkin to run real HTTP requests against a Symfony app and a real database, not unit mocks, so tests catch config and serialization mistakes. Examples include a delete-task scenario that asserts status and database persistence, JSON schema checks that use additionalProperties false to catch accidental leaks, security checks that expect 401 or 404, and a setup that runs about 15,000 steps across 1,000+ scenarios in ~5.5 minutes. Built demo to-do app works end to end.

AI-written summary · about

  1. 0:00API testing with Behat
  2. 1:16What is Behat
  3. 3:02Writing feature tests
  4. 5:54API responses and DB state
  5. 7:39JSON schema validation
  6. 9:09Security checks
  7. 10:56Scenario outlines
  8. 11:59Tags and hooks
  9. 14:31Background steps
  10. 15:17Behat for API testing
  11. 17:03Best practices
  12. 18:09Q&A: Complex endpoints
  13. 20:19Q&A: Mocking services
  14. 21:23Q&A: Writing test steps
  15. 22:47Q&A: HTTP kernel tests
  16. 26:01Q&A: Performance handling
  17. 27:25Q&A: Mocking Symfony deps
  18. 28:26Q&A: Dynamic fixtures
  19. 29:50Q&A: DB transactions
  20. 30:13Q&A: Testable steps
  21. 31:19Q&A: Debugging failures
  22. 31:40Q&A: Product owners
  23. 32:47Q&A: Symfony config
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.