Skip to content

Commit

Permalink
Merge pull request #395 from weaverryan/allow-symfony-7
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Sep 12, 2023
2 parents 8d8fe64 + 0dc1623 commit 1e3b85f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Loader/SymfonyFixturesLoader.php
Expand Up @@ -8,17 +8,17 @@
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\Loader;
use LogicException;
use ReflectionClass;
use RuntimeException;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;

use function array_key_exists;
use function array_values;
use function get_class;
use function sprintf;

final class SymfonyFixturesLoader extends ContainerAwareLoader
final class SymfonyFixturesLoader extends Loader
{
/** @var FixtureInterface[] */
private $loadedFixtures = [];
Expand Down
5 changes: 2 additions & 3 deletions Tests/Command/LoadDataFixturesDoctrineCommandTest.php
Expand Up @@ -9,7 +9,6 @@
use Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Container;
use TypeError;

use function sprintf;
Expand All @@ -24,7 +23,7 @@ class LoadDataFixturesDoctrineCommandTest extends TestCase
*/
public function testInstantiatingWithoutManagerRegistry(): void
{
$loader = new SymfonyFixturesLoader(new Container());
$loader = new SymfonyFixturesLoader();

try {
new LoadDataFixturesDoctrineCommand($loader);
Expand All @@ -47,7 +46,7 @@ public function testInstantiatingWithoutManagerRegistry(): void
public function testInstantiatingWithManagerRegistry(): void
{
$registry = $this->createMock(ManagerRegistry::class);
$loader = new SymfonyFixturesLoader(new Container());
$loader = new SymfonyFixturesLoader();

new LoadDataFixturesDoctrineCommand($loader, $registry);
}
Expand Down
7 changes: 3 additions & 4 deletions Tests/IntegrationTest.php
Expand Up @@ -22,7 +22,6 @@
use LogicException;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -51,7 +50,7 @@ public function testFixturesLoader(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
assert($loader instanceof Loader);

$actualFixtures = $loader->getFixtures();
$this->assertCount(2, $actualFixtures);
Expand Down Expand Up @@ -84,7 +83,7 @@ public function testFixturesLoaderWhenFixtureHasDepdencenyThatIsNotYetLoaded():
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
assert($loader instanceof Loader);

$actualFixtures = $loader->getFixtures();
$this->assertCount(2, $actualFixtures);
Expand Down Expand Up @@ -123,7 +122,7 @@ public function testExceptionWithDependenciesWithRequiredArguments(): void
$container = $kernel->getContainer();

$loader = $container->get('test.doctrine.fixtures.loader');
assert($loader instanceof ContainerAwareLoader);
assert($loader instanceof Loader);

$this->expectException(LogicException::class);
$this->expectExceptionMessage('The getDependencies() method returned a class (Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\DataFixtures\RequiredConstructorArgsFixtures) that has required constructor arguments. Upgrade to "doctrine/data-fixtures" version 1.3 or higher to support this.');
Expand Down
3 changes: 1 addition & 2 deletions Tests/IntegrationTestKernel.php
Expand Up @@ -79,8 +79,7 @@ public function getLogDir(): string
return sys_get_temp_dir();
}

/** @return void */
protected function build(ContainerBuilder $container)
protected function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Expand Up @@ -25,11 +25,11 @@
"doctrine/doctrine-bundle": "^1.11|^2.0",
"doctrine/orm": "^2.6.0",
"doctrine/persistence": "^1.3.7|^2.0|^3.0",
"symfony/config": "^3.4|^4.3|^5.0|^6.0",
"symfony/console": "^3.4|^4.3|^5.0|^6.0",
"symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0",
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0",
"symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0"
"symfony/config": "^3.4|^4.3|^5.0|^6.0|^7.0",
"symfony/console": "^3.4|^4.3|^5.0|^6.0|^7.0",
"symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0|^7.0",
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0|^7.0",
"symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0|^7.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
Expand Down

0 comments on commit 1e3b85f

Please sign in to comment.