ynloultratech /
graphql-bundle
| 1 | <?php |
||
| 2 | /******************************************************************************* |
||
| 3 | * This file is part of the GraphQL Bundle package. |
||
| 4 | * |
||
| 5 | * (c) YnloUltratech <[email protected]> |
||
| 6 | * |
||
| 7 | * For the full copyright and license information, please view the LICENSE |
||
| 8 | * file that was distributed with this source code. |
||
| 9 | ******************************************************************************/ |
||
| 10 | |||
| 11 | namespace Ynlo\GraphQLBundle\Behat\Fixtures; |
||
| 12 | |||
| 13 | use Behat\Behat\EventDispatcher\Event\ScenarioTested; |
||
| 14 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||
| 15 | use Symfony\Component\HttpKernel\KernelInterface; |
||
| 16 | use Ynlo\GraphQLBundle\Test\FixtureLoader\FixtureLoader; |
||
| 17 | |||
| 18 | class LoadFixturesSubscriber implements EventSubscriberInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var KernelInterface |
||
| 22 | */ |
||
| 23 | protected $kernel; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var FixtureManager |
||
| 27 | */ |
||
| 28 | protected $fixtureManager; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * LoadFixturesSubscriber constructor. |
||
| 32 | * |
||
| 33 | * @param KernelInterface $kernel |
||
| 34 | */ |
||
| 35 | public function __construct(KernelInterface $kernel, FixtureManager $fixtureManager) |
||
| 36 | { |
||
| 37 | $this->kernel = $kernel; |
||
| 38 | $this->fixtureManager = $fixtureManager; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | public static function getSubscribedEvents() |
||
| 45 | { |
||
| 46 | return [ |
||
| 47 | ScenarioTested::BEFORE => 'loadFixtures', |
||
| 48 | ]; |
||
| 49 | } |
||
| 50 | |||
| 51 | public function loadFixtures() |
||
| 52 | { |
||
| 53 | $container = $this->kernel->getContainer(); |
||
| 54 | $registry = $container->get('doctrine'); |
||
| 55 | $fixturesLoader = new FixtureLoader($container, $registry); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 56 | $this->fixtureManager->setRepository($fixturesLoader->loadFixtures()); |
||
| 57 | } |
||
| 58 | } |