Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Apr 16, 2024
1 parent 1428889 commit 26f0d28
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/ORMTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ public function it_returns_repository(): void
self::assertSame($repository->reveal(), $managerTraitAware->getRepositoryTest());
}

/**
* @test
*/
public function it_returns_repository_with_Type(): void
{
$repository = $this->prophesize(TestRepository::class);

$manager = $this->prophesize(EntityManagerInterface::class);
$manager->getRepository(Argument::type('string'))->willReturn($repository->reveal());

$managerRegistry = $this->prophesize(ManagerRegistry::class);
$managerRegistry->getManagerForClass(Argument::type('string'))->willReturn($manager->reveal());

$managerTraitAware = new ConcreteService($managerRegistry->reveal());

self::assertSame($repository->reveal(), $managerTraitAware->getRepositoryWithTypeTest());
}

/**
* @test
*/
Expand Down Expand Up @@ -132,6 +150,6 @@ public function getRepositoryWithTypeTest(): EntityRepository
*
* @extends EntityRepository<T>
*/
final class TestRepository extends EntityRepository
class TestRepository extends EntityRepository
{
}

0 comments on commit 26f0d28

Please sign in to comment.