elgentos / testing-suite
Elgentos Testing Suite
Installs: 63 853
Dependents: 5
Suggesters: 0
Security: 0
Stars: 6
Watchers: 10
Forks: 0
Open Issues: 2
Requires
README
This uses youwe/testing-suite
, but we can add/change tests/packages/configuration as we like.
Installation
composer require elgentos/testing-suite --dev
Configuration
Add this to your phpstan.neon
;
includes:
- vendor/bitexpert/phpstan-magento/extension.neon
Baselines
When implementing this into an existing project, you might want to consider generating baselines so the tests will pass without having to fix all the files.
Phpstan baseline
Generate the baseline (replace app/design/frontend app/code
with your dirs);
vendor/bin/phpstan analyse --level 4 --configuration ./phpstan.neon app/code app/design/frontend --generate-baseline
Then add this to your phpstan.neon
;
includes:
- phpstan-baseline.neon
Phpmd baseline
Generate the baseline (replace app/design/frontend,app/code
with your dirs);
vendor/bin/phpmd app/design/frontend,app/code text ./phpmd.xml --generate-baseline
Phpcs baseline
Generate the baseline (replace app/design/frontend app/code
with your dirs);
vendor/bin/phpcs app/design/frontend app/code --extensions=php,phtml --report=\\DR\\CodeSnifferBaseline\\Reports\\Baseline --report-file=phpcs.baseline.xml --basepath=.\
Run it
vendor/bin/grumphp run
Gitlab CI/CD
If you are implementing this in an existing project, do the work to make all tests pass (or add the baselines). As soon as all tests pass, make sure to make the static testing job required in our internal Gitlab CI/CD, by adding this to the projects' .gitlab-ci.yml
:
static:testingsuite:
allow_failure: false
Configure Phpstorm
This assumes you're using our Docker environment.
- Go to Settings > PHP > Quality Tools
- Perform these steps for
PHP_CodeSniffer
,Mess Detector
,PHP CS Fixer
andPHPStan
:- Click on the
...
behind the Configuration dropdown. - Click on the blue
+
sign. - Choose
development_php81:latest
, click OK - Click Ok
- Click on the
- Go to Settings > Editor > Inspections > PHP > Quality Tools
- Disable
PHP CS Fixer validation
- Enable
PHP Mess Detector validation
- Under "Custom Rulesets", clear the list and add
vendor/youwe/coding-standard-magento2/src/YouweMagento2/
- Click Apply
- Under "Custom Rulesets", clear the list and add
- Enable
PHP_CodeSniffer validation
- Under "Coding standard", choose "YouweMagento2"
- Click Apply
- Enable
PHPStan validation
- Make sure the Configuration file and the Autoload file paths are empty
- Make sure you have the
phpstan.neon
file in your project root - Click Apply
- Disable
Psalm validation
- Disable