Version | Build Status | Code Coverage |
---|---|---|
master |
||
develop |
To migrate from 1.x to 2.0, follow our guide.
Open a command console, enter your project directory and execute:
$ composer require --dev macpaw/behat-doctrine-fixtures
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
If you use PostgreSQL database, you also need to install postgresql-client:
$ apt-get install -y postgresql-client
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
BehatDoctrineFixtures\BehatDoctrineFixturesBundle::class => ['test' => true]
);
// ...
}
// ...
}
config/packages/test/behat_doctrine_fixtures.yaml
Configurating behat database context
behat_doctrine_fixtures:
connections:
default:
database_fixtures_paths:
- <path to directory with your fixtures>
You don't need to explicitly pass database url here, since this bundle uses doctrine connection under the hood. For now, we support PostgreSQL and Sqlite databases.
If you want to use multiple databases in your project, just add one more connection under behat_doctrine_fixtures.connections
with its own configuration:
behat_doctrine_fixtures:
connections:
default:
database_fixtures_paths:
- <path to directory with your fixtures>
<secondConnectionName>:
run_migrations_command: <customMigrationsCommand>
database_fixtures_paths:
- <path to directory with your fixtures>
Go to behat.yml
...
contexts:
- BehatDoctrineFixtures\Context\DatabaseContext
...