Symfony testing

Updated: 04 April 2024

Testing (Symfony Docs)

Unit Tests

These tests ensure that individual units of source code (e.g. a single class or a method in a class) behave as intended. No different from writing standard PHPUnit unit tests.

Integration Tests

These tests test a combination of classes and commonly interact with Symfony’s service container. These tests do not yet cover the fully working application.

Application Tests

Verify the behavior of a complete application. They make HTTP requests (both real and simulated ones) and test that the response is as expected.

The output of the make:test command supplies a useful summary too

root@5b8333e33939:/var/www/html# bin/console make:test

 Which test type would you like?:
  [TestCase       ] basic PHPUnit tests
  [KernelTestCase ] basic tests that have access to Symfony services
  [WebTestCase    ] to run browser-like scenarios, but that do nott execute JavaScript code
  [ApiTestCase    ] to run API-oriented scenarios
  [PantherTestCase] to run e2e scenarios, using a real-browser or HTTP client and a real web server
 >

Leave a comment