A minimal Docker image for testing Magento 2 modules.
-
Copy the environment file:
cp .env.example .env
-
Build the Docker image:
make build PHP_VERSION=8.3 OPENSEARCH_VERSION=2.14
-
Install your Magento module:
make install MAGENTO_VERSION=2.4.7
-
Upload and install the module:
make upload && make install-module MODULE_PATH=/path/to/Vendor/Module
-
Run tests:
make tests
Docker will first use the default variables defined in the .env file, but their values can be overridden by passing arguments to the make command.
- Installs Magento modules
- Runs PHP unit/integration, performance and MTFT tests
- Static code analysis (PHPStan, Psalm, Phan, PHPCS, PHPMD)
- Code formatting (Rector, PHPCBF)
-
The current
rector.php
configuration is compatible with Rector version ^0.17.60, which does not support Magento 2.4.3. To use Rector with Magento 2.4.3, you need to use a configuration compatible with version 0.11.13. -
When you encounter the error "the php-ast extension must be loaded in order for Phan to work," execute the following command to install the
ast
extension:
docker exec -it --user root php-fpm-test pecl install ast
Additionally, make sure to uncomment the extension=ast.so
line in the php-fpm/php.ini
configuration file.
- Static analysis
- Code formatting
- Unit tests
- Integration tests
- Rector
- MTFT tests
- Performance testing