Testing Symfony 4 (+JS)
-
Use Symfony Panther for browser testing in Symfony. More info at Symfony Blog. It’s is a form of an answer to Laravel Dusk
-
Use hautelook/AliceBundle bundle to generate real-looking data for your test fixtures, using Faker and Alice.
Alternatives:
- Codeception for Symfony
- Laravel Dusk in Symfony: unglud/dusker or duncan3dc/dusk
Test Types:
- Unit Tests: testing of individual units (functions, classes) by supplying input and making sure the output is as expected
- Integration Tests: testing processes across several units (classes) to achieve their goals
- Functional Tests (e2e, end2end tests): testing how scenarios function on the product itself, by controlling the browser/website. Usually ignore internals of the application and looks at app from the outside. Part of functional tests are smoke tests, as the most basic preliminary testing to reveal really simple failures, but severe enough to reject a release.
An Overview of JavaScript Testing in 2019 but also a great resource about testing in general.
Symfony Samples:
- Symfony Unit Testing Part 1 - Getting started
- Symfony Unit Testing Part 2 - Test Doubles
- Symfony Unit Testing – With a Database
There is no need to test with MySQL. You could use the faster SQLite. Remember. You are not testing Doctrine. You are testing your application that uses Doctrine. This means we can expect that doctrine queries behave the same in SQLite and MySQL.