To begin, navigate to your project directory and use Composer to download the bundle.
Simply run the following command:
composer require --dev macpaw/behat-doctrine-fixtures
If your project doesn't use Symfony Flex, run the same command:
composer require --dev macpaw/behat-doctrine-fixtures
Make sure that Composer is installed globally on your machine. If not, refer to the Composer installation guide for assistance.
Next, you'll need to manually register the bundle in the AppKernel.php
file. Add the following line to the registerBundles
method:
<?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>
Go to behat.yml
...
contexts:
- BehatDoctrineFixtures\Context\DatabaseContext
...