forked from doctrine/DoctrineFixturesBundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to instantiate Loader with ManagerRegistry
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters