mediact / testing-suite
Contains MediaCT's default testing packages.
Installs: 53 477
Dependents: 19
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 8
Open Issues: 5
Type:composer-plugin
Requires
- php: ^7.1
- composer-plugin-api: ^1.1 || ^2.0
- enlightn/security-checker: ^1.5
- kint-php/kint: @stable
- mediact/coding-standard: @stable
- mediact/coding-standard-phpstorm: @stable
- mediact/composer-dependency-installer: ^1.0
- mediact/composer-file-installer: ^1.0
- mediact/composer-unclog-plugin: ^1.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpro/grumphp: >=0.19 <1.0
- phpstan/phpstan: @stable
- phpunit/phpunit: @stable
Requires (Dev)
- composer/composer: @stable
- mikey179/vfsstream: @stable
Replaces
- dev-master
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.25.2
- 1.25.2-beta1
- 1.25.1
- 1.25.0
- 1.24.0
- 1.23.1
- 1.23.0
- 1.22.0
- 1.21.5
- 1.21.4
- 1.21.3
- 1.21.2
- 1.21.1
- 1.21.0
- 1.20.2
- 1.20.1
- 1.20.0
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.1
- 1.12.0
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.0
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/endoflife
- dev-feature/prettier
- dev-support/1.x
- dev-feature/APD-1508
- dev-feature/mysql-8-php-74
- dev-feature/composer-2-compatibility
- dev-feature/support-symfony-4x
- dev-feature/support-composer-v2
- dev-feature/allow-phpunit-9x
- dev-feature/enable-symfony-5x
This package is auto-updated.
Last update: 2022-08-10 18:05:12 UTC
README
[ABANDONED] MediaCT Testing Suite
This package has been abandoned and will not get any support. We replaced it with the youwe testing suite.
This package serves as an umbrella package for several of MediaCT's testing packages.
Installation
composer require mediact/testing-suite --dev
Usage
The testing suite can be run through the GrumPHP command.
vendor/bin/grumphp run
The testing suite is also automatically run at each git commit using a git commit hook.
Components
The following components are part of the testing suite.
Coding style validation (PHPCS)
The coding style is validated using PHPCS and uses the MediaCT Coding Standard.
During the installation of the testing suite a file called phpcs.xml
is added to
the root of the repository which refers to the coding standard. To make
adjustments to the coding standard this file can be edited and committed.
Depending on the composer type of the project an other standard will be used:
magento-module
: MediaCT Coding Standard Magento1magento2-module
: MediaCT Coding Standard Magento2magento-project
: MediaCT Coding Standard Magento1magento2-project
: MediaCT Coding Standard Magento2
Overriding the type
The type for a project can be overridden in the composer.json config
node by
adding testing-suite-type
to the configuration.
This will allow the use of standards for a different type.
The allowed values for this node are:
- magento1
- magento2
- default
The configurations looks like the following:
{ "config": { "mediact-testing-suite": { "type": "magento2" } } }
This can be helpful when development is done in the app/code
folder and force
the testing suite to automatically select the correct standards.
Coding complexity validation (PHPMD)
The complexity of the code is validated using PHPMD. A file called phpmd.xml
is added during the installation of the testing suite.
Static code analysis (PHPStan)
Static code analysis is executed using PHPStan. A file called phpstan.neon
is added during the installation of the testing suite.
Unit tests (PHPUnit)
Unit tests are executed using PHPUnit. A file called phpunit.xml
is added
during the installation of the testing suite.
The unit tests are expected to be in a directory called tests
. The code is
expected to be in a directory called src
.
Bitbucket Pipelines
When the project is hosted on Bitbucket a
Pipelines script will be
installed. The scripts supports a callback that will be called before
composer install
is executed. This callback can be used to add credentials
to composer. To enable the callback go to Bitbucket Settings > Pipelines >
Environment Variables and add an environment variable called
COMPOSER_PRE_INSTALL_CALLBACK
.
Example to add basic authentication for repo.example.com:
composer config --global http-basic.repo.example.com $YOUR_USER $YOUR_PASSWORD
ESLint
Javascript linting for Magento 1 and Magento 2 projects is executed using
ESLint. Two files called .eslintrc.json
and
.eslintignore
are added to the root of the repository which contains the
coding standards and files excluded from analysis.
A third file called package.json
is added which contains the needed npm
modules. Run npm install
after the installation in order to enable ESLint:
npm install
Integration with PHPStorm
When the testing suite is installed in a PHPStorm environment it automatically configures PHPStorm to use the correct coding style.
To enable PHPCS and PHPMD inspections in PHPStorm the correct binaries need to be configured. This is a global setting in PHPStorm and can therefore not be configured by the testing suite.
The recommended way to get the correct binaries is by installing the MediaCT Coding Standard globally.
composer global require mediact/coding-standard
The package will be installed in the home directory of composer. The location of this directory can be found using the following command:
composer global config home
Open PHPStorm and go to Settings > Languages & Frameworks > PHP > Code Sniffer.
Choose "Local" for the development environment and fill in the full path to
<composer_home_directory>/vendor/bin/phpcs
.
Then go to Settings > Languages & Frameworks > PHP > Mess Detector.
Choose "Local" for the development environment and fill in the full path to
<composer_home_directory>/vendor/bin/phpmd
.
After these adjustments the coding style and complexity will be validated while typing in PHPStorm.
To enable ESLint open PHPStorm and go to Settings > Languages & Frameworks > Javascript > Code Quality Tools > ESLint.
Enable ESLint by checking Enabled
. Then set the Node interpreter
to Project
and Configuration file
to Automatic Search
.