Training program "Back-end Developer: PHP/Symfony" (OpenClassrooms)
Project 8: Upgrade an existing project (study project)
- Improving the MVP of a start-up: upgrade & fix code, implement authorizations & automated tests
- The mission: https://openclassrooms.com/projects/ameliorer-un-projet-existant-1
- The MVP: https://github.com/saro0h/projet8-TodoList
✅ Validated on June 14, 2023
xamppserver
MySQL / MariaDB
PHP 8.1
Symfony 5.4
-
Clone the repository to work on your localhost.
-
To install the dependencies, run the following command at the root of the project:
composer intall
-
Launch xamppserver, configure your php version.
-
Create the database running:
php bin/console doctrine:database:create
-
Import its structure using this command:
php bin/console doctrine:schema:update --force
-
You can also load the fixtures as initial set of data:
php bin/console doctrine:fixtures:load
-
Launch the Symfony server running:
symfony server:start
🎉 Congrats! You can now watch at the project in your navigator following the link given in your terminal, mostly: https://localhost:8000/
-
Once your project is installed as described above, you should have PHPUnit, phpunit-bridge (in the project, running composer) & x-debug (in Xampp) ready.
-
Configure your .env.test file to access the test data in your database.
-
Create the test database & its tables running:
php bin/console doctrine:database:create
php bin/console doctrine:schema:update --force
-
Then load the test fixtures:
php bin/console doctrine:fixtures:load
- their classes & methods in the repository /tests/
- their results in /public/test-coverage/
- read it easily in a navigator: https://localhost:8000/test-coverage/index.html
-
Write your code in tests/
-
To execute all tests, run the following command:
php vendor/bin/phpunit
-
Generate the test coverage report running:
php vendor/bin/phpunit --coverage-html public/test-coverage