ahilles107 / doctrine-data-fixtures-extension
Doctrine data fixtures extension for Behat
Requires
- php: ^7.1 | ^8.0
- behat/behat: ^3.0
- behat/symfony2-extension: ^2.0
- doctrine/data-fixtures: ^1.0
- doctrine/orm: ^2.6
- symfony/dependency-injection: ^3.4|^4.0
Requires (Dev)
- adamquaile/behat-command-runner-extension: ^0.1.1
- doctrine/doctrine-bundle: ^1.8
- doctrine/doctrine-fixtures-bundle: ^3.0
- symfony/process: ^3.4|^4.0
- symfony/var-dumper: ^3.4|^4.0
Suggests
- doctrine/migrations: Uses DBAL to load versioned database schema and migration classes
- symfony/process: For backup support on pgsql or mysql platforms
- v7.0.x-dev
- v6.0.x-dev
- 6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.0.x-dev
- v5.0.1
- v5.0.0
- v5.0.0-beta.1
- v4.0.x-dev
- v4.0.1
- v4.0.0
- 3.0.0
- 2.5.6
- 2.5.5
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10
- v0.9.15
- v0.9.14
- v0.9.13
- v0.9.12
- v0.9.11
- v0.9.10
- v0.9.9
- v0.9.8
- v0.9.7
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9
This package is auto-updated.
Last update: 2024-12-05 04:30:14 UTC
README
The extension increases feature test isolation by reloading ORM data fixtures between scenarios and features.
Installation
composer require "behat-extension/doctrine-data-fixtures-extension"
Configuration
Activate extension in your behat.yml and define any fixtures to be loaded:
# behat.yml default: # ... extensions: BehatExtension\DoctrineDataFixturesExtension\Extension: lifetime: 'feature' directories: ~ fixtures: ~
When lifetime is set to "feature" (or unspecified), data fixtures are reloaded between feature files. Alternately, when lifetime is set to "scenario", data fixtures are reloaded between scenarios (i.e., increased test isolation at the expense of increased run time).
When fixtures is set, the extension will load the specified fixture classes.
This must contain a list of fully qualified class names. Classes MUST not have any constructor arguments (or at least optional).
If the interface Symfony\Component\DependencyInjection\ContainerAwareInterface
is implemented, the container is set to the fixture loader.
When directories is set, the extension will load the data fixtures globed from the respective directories.
Classes MUST not have any constructor arguments (or at least optional).
If the interface Symfony\Component\DependencyInjection\ContainerAwareInterface
is implemented, the container is set to the fixture loader.
This extension will also load every fixtures declared as services and tagged with doctrine.fixture.orm
.
# behat.yml default: # ... extensions: BehatExtension\DoctrineDataFixturesExtension\Extension: lifetime: 'feature' directories: - '/project/src/AcmeAnalytics/Tests/DataFixtures/ORM' fixtures: - 'Acme\StoreBundle\DataFixture\ORM\Categories' - 'Acme\StoreBundle\DataFixture\ORM\Apps' - 'Acme\VendorBundle\DataFixture\ORM\Vendors'
Backup System
To speed up the tests, a backup system is available. The whole database will be set in cache and reloaded when needed. You should periodically clear the cache as it does not detect changes to the data fixture contents because the hash is based on the collection of data fixture class names.
This feature is only available for SQLite, MySQL and PostgreSQL.
- For MySQL,
mysql
andmysqldump
must be available. - For PostgreSQL,
pg_restore
andpg_dump
must be available.
It is enabled by default. To disable it, you just have to set use_backup: false
in the extension configuration:
# behat.yml default: # ... extensions: BehatExtension\DoctrineDataFixturesExtension\Extension: lifetime: 'feature' use_backup: false
Source
Github: https://github.com/BehatExtension/DoctrineDataFixturesExtension
Forked from https://github.com/vipsoft/DoctrineDataFixturesExtension
Copyright
- Copyright (c) 2012 Anthon Pang.
- Copyright (c) 2016-2018 Florent Morselli.
See LICENSE for details.
Contributors
- Anthon Pang (robocoder)
- Florent Morselli (Spomky)
- Others contributors