Skip to content

Commit a368efd

Browse files
committed
Add test for TargetEntitiesResolver with duplicated model
The `Fly` model is used by both `app.fly` and `app.another_resource_with_fly_model` and its interfaces should be part of the result.
1 parent 2337f5b commit a368efd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Bundle/spec/DependencyInjection/Compiler/Helper/TargetEntitiesResolverSpec.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ function it_autodiscovers_only_unique_interfaces_based_on_model_classes(): void
6969
$this->resolve($config)->shouldNotHaveKeyWithValue(AnimalInterface::class, Bear::class);
7070
}
7171

72+
function it_autodiscovers_interfaces_on_models_when_passed_multiple_times(): void
73+
{
74+
$config = [
75+
'app.fly' => ['classes' => ['model' => Fly::class]],
76+
'app.another_resource_with_fly_model' => ['classes' => ['model' => Fly::class]],
77+
];
78+
79+
$this->resolve($config)->shouldHaveCount(2);
80+
$this->resolve($config)->shouldHaveKeyWithValue(FlyInterface::class, Fly::class);
81+
$this->resolve($config)->shouldHaveKeyWithValue(AnimalInterface::class, Fly::class);
82+
}
83+
7284
function it_uses_the_interface_defined_in_the_config(): void
7385
{
7486
$config = [

0 commit comments

Comments
 (0)