Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjeguedes/symfonytdac
Symfony 3 upgrade and application management
https://github.com/sjeguedes/symfonytdac
blackfire faker functional-testing phpunit symfony3 symfony4 unit-testing upgrade
Last synced: 24 days ago
JSON representation
Symfony 3 upgrade and application management
- Host: GitHub
- URL: https://github.com/sjeguedes/symfonytdac
- Owner: sjeguedes
- Created: 2020-05-19T09:49:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-01T19:46:02.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T06:04:48.348Z (24 days ago)
- Topics: blackfire, faker, functional-testing, phpunit, symfony3, symfony4, unit-testing, upgrade
- Language: PHP
- Homepage:
- Size: 854 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![CI tests & code quality](https://github.com/sjeguedes/symfonyTDAC/actions/workflows/full-ci-workflow.yml/badge.svg)](https://github.com/sjeguedes/symfonyTDAC/actions/workflows/full-ci-workflow.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/cd0698a66913d668f94b/maintainability)](https://codeclimate.com/github/sjeguedes/symfonyTDAC/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/cd0698a66913d668f94b/test_coverage)](https://codeclimate.com/github/sjeguedes/symfonyTDAC/test_coverage)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d7c1a32d50db45d5ab05ec44db19dce0)](https://www.codacy.com/gh/sjeguedes/symfonyTDAC/dashboard?utm_source=github.com&utm_medium=referral&utm_content=sjeguedes/symfonyTDAC&utm_campaign=Badge_Grade)
# SymfonyTDAC## Symfony upgrade from version 3.1 to 4.4 LTS, with bugs fixing and features improvements
This application manages tasks as a kind of simple "to do list".
It is only accessible with a user account, and obviously he has to be authenticated!- An anonymous user (visitor) is automatically redirected to login page.
- An authenticated user is redirected to application homepage after successful login action.
- A disconnected user is redirected to login page again.
Task features:
- Each task is associated to a single author.
- Each task is updated by a single last editor.
- A task without author was considered created by an "anonymous author" (user).
- A task author, if one exists, is definitely set after creation.User features:
- An authenticated user can only manage tasks.
- An authenticated user can list all tasks with or without a "isDone" state filter, and then access a particular dedicated list.
- An authenticated user can create any tasks.
- An authenticated user can toggle any tasks "isDone" state by marking selected one as "done/undone".
- An authenticated user can update (edit) any tasks as last editor.
- An authenticated user can only delete his own created tasks.Administrator features:
- An authenticated administrator (admin) can also manage other registered users.
- An authenticated administrator benefits from the same user permissions on tasks.
- An authenticated administrator can list all users accounts.
- An authenticated administrator can create another user account and define his roles (user, admin).
- An authenticated administrator can update all users accounts and redefine his roles.
- An authenticated administrator can delete all users accounts.###### *Please note that this project uses these libraries or Symfony bundles:*
Faker PHP library (in order to add custom data fixtures)
> https://github.com/FakerPHP/FakerDoctrine test bundle (in order to manage automated tests and easily rollback database transaction)
> https://github.com/dmaicher/doctrine-test-bundle### Local installation (can be used on deployment with ssh access with some adaptations for environment variables)
#### 1. Clone project repository master branch on GitHub with:
```
$ git clone https://github.com/sjeguedes/symfonyTDAC.git
```#### 2. Configure project needed particular data and your own database parameters with environment variables in `env.local` file using `.env` provided example file:
###### *Prefer use a `env..local` file per environment combined to `env.local.php` to manage each environment.*
```
# Application environnement and secret
APP_ENV=your_environment # e.g. "dev", "test" or "prod"
APP_SECRET=your_secret# Database configuration (example here with MySQL)
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7
```
#### 3. Adapt Doctrine "dbal" section configuration (driver and server_version) to your system requirements in `config/packages/doctrine.yaml` file if needed:###### *For instance, this is needed if you use another driver such as PostgreSQL, MariaDB, etc... instead of MySQL.*
#### 4. Install dependencies defined in composer.json:
```
# Development (dev) environment
$ composer install
# Production (prod) environnement
$ composer install --no-dev --no-scripts --optimize-autoloader
```#### 5. Create database and schema with Doctrine migrations located in `migrations` folder:
```
# Create database
$ php bin/console doctrine:database:create
```###### *Use migrations instead of updating schema!*
```
# Create schema
$ php bin/console doctrine:migrations:migrate
```#### 6. Add starting set of data with Doctrine fixtures located in `src/DataFixtures`:
```
$ php bin/console doctrine:fixtures:load
# or add "-n" option to avoid console interactivity
$ php bin/console doctrine:fixtures:load -n
```#### 7. Application automated tests:
###### *Please note that 3 automated test suites were made with PHPUnit test framework, to maintain this project correctly.*
###### *You can have a look at `tests` folder divided in 3 sub folders (Unit, Integration, Functional) and `env.test` example file:*
For local installation:
```
# You can or simply use option "--env=test" for each command or switch to "test" environnement
and install "test" particular database thanks to ".env.test.local" file configuration.
# e.g. with ".env.local.php"
$ composer dump-env test
# Then follow the same process as above to create "test" database and generate fixtures for this environment.# Execute all existing test suites after "test" environnement installation:
$ php bin/phpunit
# or to be more explicit:
$ php bin/phpunit tests
# or:
$ php bin/phpunit --testsuite 'Project Tests Suite'# Execute only unit test suite:
$ php bin/phpunit tests/Unit
# or:
$ php bin/phpunit --testsuite 'Project Unit Tests Suite'# Execute only integration test suite:
$ php bin/phpunit tests/Integration
# or:
$ php bin/phpunit --testsuite 'Project Integration Tests Suite'# Execute only functional test suite:
$ php bin/phpunit tests/Functional
# or:
$ php bin/phpunit --testsuite 'Project Functional Tests Suite'
```
###### *You can have a look at `phpunit.xml.dist` example file located in project root folder, to manage PHPUnit configuration*
PHPUnit current documentation:
> https://phpunit.readthedocs.io#### 8. Project contribution:
If you are interested in improving this project you can follow our guidelines defined in [Contributing file](CONTRIBUTING.md).
You are welcome to make this application evolve.