<?php /** * @copyright Macintoshplus (c) 2020 * Added by : Macintoshplus at 09/04/2020 21:58 */ declare(strict_types=1); namespace App\Tests\Behat\Hook; use Behat\Behat\Context\Context; use Symfony\Component\Process\Process; final class LoadFixturesContext implements Context { /** * @BeforeScenario */ public function loadFixture() { $cmd = new Process([\PHP_BINARY, 'bin/console', 'doctrine:fixtures:load', '-n']); $cmd->run(); if ($cmd->getExitCode() !== 0) { dump($cmd->getOutput(), $cmd->getErrorOutput()); throw new \Exception('Unable to load fixtures'); } } }