phariscope / doctrine-testing-tools
A PHP component to test Doctrine Repositories
Installs: 1 105
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 2
Open Issues: 0
Requires
- php: >=8.1
- doctrine/doctrine-bundle: ^2
- doctrine/orm: ^2|^3
- symfony/dotenv: ^6|^7.0
- symfony/framework-bundle: ^6|^7.0
- symfony/http-kernel: ^6|^7.0
- symfony/runtime: ^6|^7.0
- symfony/yaml: ^6|^7.0
Requires (Dev)
- infection/extension-installer: 0.1.2
- infection/infection: ^0.27
- phpstan/phpdoc-parser: ^1.20
- phpstan/phpstan: 1.10.15
- phpunit/phpunit: ^10
- squizlabs/php_codesniffer: 3.*
README
A PHP component to help testing Doctrine SQL Repositories.
To reduce process time, this component will only drop requested tables using SQL queries. I only use it on MySQL and SQLite databases so I do not need this component to work with other solutions.
Usage
To use this component, you need to :
- Add DoctrineRepositoryTesterTrait to every doctrine repository tests.
- In
setUp()
, call$this->initDoctrineTester()
to initialize the tester. You now have access to :clearTables(array $tablesToClear)
to clear every table you want to clear.getEntityManager()
to access an instance of EntityManagerInterface for your repository.
Look into the ExempleRepositoryDoctrine if you need an exemple.
Install
composer require --dev phariscope/doctrine-testing-tools
To contribute to Doctrine Testing Tools
Requirements:
- docker
- git
Unit tests
bin/phpunit
Integration tests
bin/phpunit-integration
Quality
Some indicators:
- phpcs PSR12
- phpstan level 9
- coverage >= 100%
- infection MSI >= 100%
Quick check with:
./codecheck
Check coverage with:
bin/phpunit --coverage-html var
and view 'var/index.html' in your browser
Check infection with:
bin/infection
and view 'var/infection.html' in your browser