Skip to content

Instantly share code, notes, and snippets.

@Zayon
Last active November 11, 2018 19:07
Show Gist options
  • Save Zayon/283740e85cc99b000d4925609e609aef to your computer and use it in GitHub Desktop.
Save Zayon/283740e85cc99b000d4925609e609aef to your computer and use it in GitHub Desktop.
Fixtures in Symfony 4
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
class FixtureContext implements Context
{
// Empty for now
}
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Fidry\AliceDataFixtures\LoaderInterface;
class FixtureContext implements Context
{
/** @var LoaderInterface */
private $loader;
/** @var string */
private $fixturesBasePath;
public function __construct(
Registry $doctrine,
LoaderInterface $loader,
string $fixturesBasePath
) {
$this->loader = $loader;
$this->fixturesBasePath = $fixturesBasePath;
// use odctrine to create the sqlite database
}
}
<?php
declare(strict_types=1);
use Behat\Behat\Context\Context;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Fidry\AliceDataFixtures\LoaderInterface;
class FixtureContext implements Context
{
/** @var LoaderInterface */
private $loader;
/** @var string */
private $fixturesBasePath;
public function __construct(
Registry $doctrine,
LoaderInterface $loader,
string $fixturesBasePath
) {
$this->loader = $loader;
$this->fixturesBasePath = $fixturesBasePath;
// use odctrine to create the sqlite database
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment