Skip to content

Commit

Permalink
Add test to instantiate Loader with ManagerRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Jun 12, 2019
1 parent 9240120 commit 84e2311
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Tests/Command/LoadDataFixturesDoctrineCommandTest.php
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Doctrine\Bundle\FixturesBundle\Tests\Command;

use Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand;
use Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader;
use Doctrine\Common\Persistence\ManagerRegistry;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;

class LoadDataFixturesDoctrineCommandTest extends TestCase
{
/**
* @group legacy
* @expectedDeprecation The "Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand" constructor expects a "Doctrine\Common\Persistence\ManagerRegistry" instance as second argument, not passing it will throw a \TypeError in DoctrineFixturesBundle 4.0.
*/
public function testInstantiatingWithoutManagerRegistry() : void
{
$loader = new SymfonyFixturesLoader(new Container());

new LoadDataFixturesDoctrineCommand($loader);
}

/**
* @doesNotPerformAssertions
*/
public function testInstantiatingWithManagerRegistry() : void
{
$registry = $this->createMock(ManagerRegistry::class);
$loader = new SymfonyFixturesLoader(new Container());

new LoadDataFixturesDoctrineCommand($loader, $registry);
}
}
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Expand Up @@ -17,4 +17,8 @@
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>

0 comments on commit 84e2311

Please sign in to comment.