seec / behat-magento2-extension
Magento2 extension for Behat
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 6
Type:behat-extension
Requires
- php: ^8.1
- behat/behat: ^3.7
- container-interop/container-interop: ^1.2
- friends-of-behat/page-object-extension: ^0.3.2
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.0
- magento/framework: 103.0.6
- magento/module-authorization: *
- magento/module-backend: *
- magento/module-store: 101.1.6
- magento/module-user: *
- react/promise: ~2.0
- seec/behat-test-runner: ^8
- symfony/dependency-injection: ^6
- symfony/event-dispatcher: ^6
Requires (Dev)
- pdepend/pdepend: ^2.10
- phpmd/phpmd: ^2.12
- phpstan/phpstan: ^1.10
- phpstan/phpstan-symfony: ^1.3
- phpstan/phpstan-webmozart-assert: ^1
- phpunit/phpunit: ^9.5
- sebastian/phpcpd: ^6.0
- symfony/finder: ^5.4
- symplify/config-transformer: ^12.0
- symplify/easy-coding-standard: ^11.3
This package is auto-updated.
Last update: 2024-10-12 01:27:49 UTC
README
This is a fork of the BehatMagentoExtension, which is compatible with PHP8.1 and greater. This should ensure successful end-to-end testing of Magento 2 projects.
The BehatMagento2Extension
provides a custom service container for Behat which allows to inject Magento services into
Behat Contexts and Behat helper services.
Installation
The recommended installation method is through Composer:
composer require seec/behat-magento2-extension
Usage
In order to bootstrap Magento2 into your Behat suite, some modifications to the used behat.yml are required.
Note: If you use the Hooks provided by this package, your Magento Database will be purged and refilled with your fixtures after each individual test. This adds extra time to the execution but leaves your database also with DUMMY data. Do not use the hooks if you want to keep your database intact. Do not use it on a production server if you don't know what you are doing.
Testing
If you want to contribute to this module, make sure to run tests locally before committing. Docker Compose Containers are set-up to run all tests for all PHP versions automatically, so testing is very easy.
$ cp .env.dist .env // make sure to add your keys to the .env file otherwise testing will not work! $ docker compose build $ docker compose up -d $ docker compose exec php sh $ install-magento $ install-extension $ cd /var/www/html/vendor/seec/behat-magento2-extension $ php vendor/bin/behat
Code Quality
We aim for a unified code style; thus we enforce ECS and PHPStan onto our code. Make sure to run the following commands before committing:
$ php vendor/bin/ecs check src/ tests/ features/ --fix $ php vendor/bin/phpstan analyse src/ --level=8 $ php vendor/bin/phpstan analyse features/ --level=8 $ php vendor/bin/phpstan analyse tests/ --level=5
Documentation
The official documentation is available here.