How to set up a Symfony application test pipeline on Gitlab CI

Gitlab offers tools to set up a CI pipeline in order to analyze and test your code automatically before merging. I’ll show an implementation for a Symfony 3 and 4 application (or any other framework capable to be configured to run in test mode via an environment variable), with CI pipelines to analyze your code and run test with a dedicated database (dropped and recreated each time)

GitLab CI (taken from https://docs.gitlab.com/ee/ci/introduction/)