Passing the Behat registration feature
Now that we have a couple of failing Behat tests for the login feature, let’s try to do the minimum amount of work to complete the feature, and pass the tests. Luckily, Symfony makes it easy to implement security. We can use the symfony/security-bundle
Composer package to add authentication and authorization to our application, without having to build everything from scratch.
You can read more about Symfony’s security documentation at https://symfony.com/doc/current/security.html.
To pass the failing Behat registration feature, as Behat simulates a user using a web browser, we will have to create all the programs needed for a real user to be able to register an account in our application from the web browser, which then hits the controllers, the services, and then down to the database persistence process. Let’s start with the controllers.
Writing failing controller tests
Before passing our main Behat feature tests...