@@ -11,22 +11,18 @@ class AfterResolvingAttributeCallbackTest extends TestCase
11
11
public function testCallbackIsCalledAfterDependencyResolutionWithAttribute ()
12
12
{
13
13
$ container = new Container ();
14
- $ stack = [];
15
14
16
- $ container ->afterResolvingAttribute (ContainerTestOnTenant::class, function (ContainerTestOnTenant $ attribute , HasTenantImpl $ hasTenantImpl , Container $ container ) use (& $ stack ) {
15
+ $ container ->afterResolvingAttribute (ContainerTestOnTenant::class, function (ContainerTestOnTenant $ attribute , HasTenantImpl $ hasTenantImpl , Container $ container ) {
17
16
$ hasTenantImpl ->onTenant ($ attribute ->tenant );
18
- $ stack [] = $ attribute ->tenant ;
19
17
});
20
18
21
19
$ hasTenantA = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantA::class);
22
20
$ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantA ->property );
23
21
$ this ->assertEquals (Tenant::TenantA, $ hasTenantA ->property ->tenant );
24
- $ this ->assertContains (Tenant::TenantA, $ stack );
25
22
26
23
$ hasTenantB = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantB::class);
27
24
$ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantB ->property );
28
25
$ this ->assertEquals (Tenant::TenantB, $ hasTenantB ->property ->tenant );
29
- $ this ->assertContains (Tenant::TenantB, $ stack );
30
26
}
31
27
32
28
public function testCallbackIsCalledAfterClassWithAttributeIsResolved ()
@@ -61,19 +57,6 @@ public function testCallbackIsCalledAfterClassWithConstructorAndAttributeIsResol
61
57
$ this ->assertInstanceOf (ContainerTestHasSelfConfiguringAttributeAndConstructor::class, $ instance );
62
58
$ this ->assertEquals ('the-right-value ' , $ instance ->value );
63
59
}
64
-
65
- public function testAfterCallbackIsCalled ()
66
- {
67
- $ container = new Container ();
68
-
69
- $ hasTenantA = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantA::class);
70
- $ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantA ->property );
71
- $ this ->assertEquals (Tenant::TenantA, $ hasTenantA ->property ->tenant );
72
-
73
- $ hasTenantB = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantB::class);
74
- $ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantB ->property );
75
- $ this ->assertEquals (Tenant::TenantB, $ hasTenantB ->property ->tenant );
76
- }
77
60
}
78
61
79
62
#[Attribute(Attribute::TARGET_PARAMETER )]
@@ -83,11 +66,6 @@ public function __construct(
83
66
public readonly Tenant $ tenant
84
67
) {
85
68
}
86
-
87
- public function after (self $ attribute , HasTenantImpl $ class , Container $ container ): void
88
- {
89
- $ class ->onTenant ($ attribute ->tenant );
90
- }
91
69
}
92
70
93
71
enum Tenant
0 commit comments