diff --git a/Tests/Model/Instantiator/DoctrineConfig/ClassMetadataFactoryTest.php b/Tests/Model/Instantiator/DoctrineConfig/ClassMetadataFactoryTest.php index d404e80..601c691 100644 --- a/Tests/Model/Instantiator/DoctrineConfig/ClassMetadataFactoryTest.php +++ b/Tests/Model/Instantiator/DoctrineConfig/ClassMetadataFactoryTest.php @@ -39,16 +39,16 @@ public function testItReturnAnInstanceOfClassMetadata() public function testItAllowToRetrieveDomainModel() { - $entityManager = $this->setupDatabase(new DomainEventDispatcher(), 'testItAllowToRetrieveDomainModel'); - $dispatcher = $this->prophesize(DomainEventDispatcherInterface::class); $dispatcher->dispatch(Argument::cetera())->shouldBeCalled(); - $entityManager->getMetadataFactory()->setDispatcher($dispatcher->reveal()); + $entityManager = $this->setupDatabase($dispatcher->reveal(), 'testItAllowToRetrieveDomainModel'); $res = $entityManager->getRepository(FakeModel::class)->findAll(); - reset($res)->doAction(); + /** @var FakeModel $item */ + $item = reset($res); + $item->doAction(); $this->dropDatabase(); } } diff --git a/Tests/SetupDatabaseTrait.php b/Tests/SetupDatabaseTrait.php index 2c94b15..bb638bb 100644 --- a/Tests/SetupDatabaseTrait.php +++ b/Tests/SetupDatabaseTrait.php @@ -2,7 +2,7 @@ namespace Biig\Component\Domain\Tests; -use Biig\Component\Domain\Event\DomainEventDispatcher; +use Biig\Component\Domain\Event\DomainEventDispatcherInterface; use Biig\Component\Domain\Model\Instantiator\DoctrineConfig\PostLoadDispatcherInjectionListener; use Biig\Component\Domain\PostPersistListener\DoctrinePostPersistListener; use Doctrine\ORM\EntityManager; @@ -13,7 +13,7 @@ trait SetupDatabaseTrait { private $dbPath; - private function setupDatabase(DomainEventDispatcher $dispatcher, string $name): EntityManager + private function setupDatabase(DomainEventDispatcherInterface $dispatcher, string $name): EntityManager { $this->dbPath = \sys_get_temp_dir() . '/'.$name.'.' . \microtime() . '.sqlite'; copy(__DIR__ . '/fixtures/dbtest/initial_fake_model.db', $this->dbPath); diff --git a/Tests/config/symfony_test_kernel_config.yaml b/Tests/config/symfony_test_kernel_config.yaml index 55fd00d..b5bc8cd 100644 --- a/Tests/config/symfony_test_kernel_config.yaml +++ b/Tests/config/symfony_test_kernel_config.yaml @@ -8,8 +8,8 @@ framework: serializer: ~ form: ~ test: ~ - annotations: ~ assets: ~ + property_access: ~ doctrine: dbal: diff --git a/composer.json b/composer.json index 806113c..9925dc6 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "MIT", "require": { "php": ">=8.1", - "symfony/event-dispatcher": "^4.3|^5.0|^6.0", + "symfony/event-dispatcher": "^5.0|^6.0|^7.0", "doctrine/doctrine-bundle": "^1.8|^2.0", "doctrine/orm": "^2.6.3" }, @@ -18,9 +18,16 @@ "phpunit/phpunit": "^9.5 || ^10", "doctrine/orm": "^2.6.3", "friendsofphp/php-cs-fixer": "^3.49.0", - "symfony/symfony": "^5.0 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.0 || ^6.0", "phpspec/prophecy-phpunit": "^2.0.1", - "monolog/monolog": "^2.8.0 || ^3.2.0" + "monolog/monolog": "^2.8.0 || ^3.2.0", + "symfony/var-dumper": "^5.0 || ^6.0", + "symfony/serializer": "^5.0 || ^6.0", + "symfony/asset": "^5.0 || ^6.0", + "symfony/form": "^5.0 || ^6.0", + "symfony/property-access": "^5.0 || ^6.0", + "symfony/debug-pack": "^1.0", + "symfony/yaml": "^5.0 || ^6.0" }, "conflict": { "doctrine/orm": "<2.6.3" diff --git a/src/Integration/Symfony/DependencyInjection/Configuration.php b/src/Integration/Symfony/DependencyInjection/Configuration.php index 1f716c0..329b97b 100644 --- a/src/Integration/Symfony/DependencyInjection/Configuration.php +++ b/src/Integration/Symfony/DependencyInjection/Configuration.php @@ -7,7 +7,7 @@ class Configuration implements ConfigurationInterface { - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('biig_domain'); diff --git a/src/Model/Instantiator/DoctrineConfig/Instantiator.php b/src/Model/Instantiator/DoctrineConfig/Instantiator.php index a343f1e..6cd82ef 100644 --- a/src/Model/Instantiator/DoctrineConfig/Instantiator.php +++ b/src/Model/Instantiator/DoctrineConfig/Instantiator.php @@ -16,7 +16,7 @@ public function __construct(DomainEventDispatcherInterface $dispatcher) parent::__construct($dispatcher); } - public function instantiate($object) + public function instantiate($object): object { $this->injectDispatcher($object);