Skip to content

Commit

Permalink
fixup! Enable loader to retrieve subtree of fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni Uebernickel committed Apr 16, 2020
1 parent 70800fa commit 11fca8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Loader/SymfonyFixturesLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use RuntimeException;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
use function array_key_exists;
use function array_map;
use function array_merge;
use function array_reduce;
use function array_values;
use function get_class;
use function sprintf;
Expand Down
18 changes: 13 additions & 5 deletions Tests/Loader/ResolveFixturesSubtreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@
use Doctrine\Persistence\ObjectManager;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use function interface_exists;
use function class_alias;

/**
* @covers \Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader::getFixturesDependencyTree
* @covers \Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader::resolveFixturesDependencyTree
*/
class ResolveFixturesSubtreeTest extends TestCase
{
/**
* @var SymfonyFixturesLoader
*/
private $loader;

public static function setUpBeforeClass()
public static function setUpBeforeClass() : void
{
if (!interface_exists(ObjectManager::class)) {
if (! interface_exists(ObjectManager::class)) {
class_alias('Doctrine\Common\Persistence\ObjectManager', 'Doctrine\Persistence\ObjectManager', false);
}
}

protected function setUp()
protected function setUp() : void
{
$this->loader = new SymfonyFixturesLoader(new Container());
}
Expand Down Expand Up @@ -95,18 +100,21 @@ public function testResolveRecursively() : void
private function createFixture(array $dependencies) : FixtureInterface
{
return new class ($dependencies) implements FixtureInterface, DependentFixtureInterface {
/**
* @var string[]
*/
private $dependencies;

public function __construct(array $dependencies)
{
$this->dependencies = $dependencies;
}

public function load(ObjectManager $manager)
public function load(ObjectManager $manager) : void
{
}

public function getDependencies()
public function getDependencies() : array
{
return $this->dependencies;
}
Expand Down

0 comments on commit 11fca8c

Please sign in to comment.