elbformat / ibexa-behat-bundle
Context and Helpers to integrate behat tests in your ibexa dxp installation.
Installs: 1 686
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.1
- elbformat/field-helper-bundle: ^1.2
- elbformat/symfony-behat-bundle: ^1.5
- ibexa/experience: ^3.3
Requires (Dev)
- dvdoug/behat-code-coverage: ^5.2
- netgen/tagsbundle: ^5.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-16 10:44:08 UTC
README
Although there already is an official behat bundle for ibexa, this bundle has a completely different approach. It is optimized for faster execution by using the Symfony Kernel directly and only partially reset the database. Also, it has more strict wordings in a behavioural manner. Last but not least it also supports creating page builder blocks.
Installation
- Add the bundle via composer
composer require elbformat/ibexa-behat-bundle
- Activate bundles in
config/bundles.php
Elbformat\SymfonyBehatBundle\ElbformatSymfonyBehatBundle::class => ['test' => true], Elbformat\IbexaBehatBundle\ElbformatIbexaBehatBundle::class => ['test' => true],
-
Configure behat.yml See the symfony-behat-bundle installation instructions.
-
Use TestFilePathNormalizer In order to test uploaded images, you need a predictable filename. This can be achieved by skipping the random hash at the end, when running test. Just put the following line in your
config/services_behat.yaml
to
services: # Prevent random character in image urls for tests eZ\Publish\Core\IO\FilePathNormalizer\Flysystem: '@Elbformat\IbexaBehatBundle\IO\TestFilePathNormalizer'
Run tests
Make sure you have a database configured for the test environment.
It's recommended to have an extra database configured for tests in .env.test
, to not accidentally delete real contents.
After configuration you should initialise it once, before running any test against it.
bin/console -e test do:da:cr bin/console -e test do:mi:mi -n bin/console -e test ib:mi:mi -n bin/console -e test ibexa:reindex
Then you can simply run the tests.
vendor/bin/behat
Tweaks
When you have internal, fixed content/location ids > 1000 you may want to change the minimum id for resetting the database.
To do this, you can simply add an enviromment variable BEHAT_CONTENT_MIN_ID=10000
to .env.behat