Skip to content

Commit

Permalink
👷 Limit Sf version to 6 & fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek- committed Feb 18, 2024
1 parent 33cea8b commit 3649813
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
4 changes: 2 additions & 2 deletions Tests/SetupDatabaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Tests/config/symfony_test_kernel_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ framework:
serializer: ~
form: ~
test: ~
annotations: ~
assets: ~
property_access: ~

doctrine:
dbal:
Expand Down
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('biig_domain');

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Instantiator/DoctrineConfig/Instantiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(DomainEventDispatcherInterface $dispatcher)
parent::__construct($dispatcher);
}

public function instantiate($object)
public function instantiate($object): object
{
$this->injectDispatcher($object);

Expand Down

0 comments on commit 3649813

Please sign in to comment.