@@ -11,22 +11,18 @@ class AfterResolvingAttributeCallbackTest extends TestCase
1111 public function testCallbackIsCalledAfterDependencyResolutionWithAttribute ()
1212 {
1313 $ container = new Container ();
14- $ stack = [];
1514
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 ) {
1716 $ hasTenantImpl ->onTenant ($ attribute ->tenant );
18- $ stack [] = $ attribute ->tenant ;
1917 });
2018
2119 $ hasTenantA = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantA::class);
2220 $ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantA ->property );
2321 $ this ->assertEquals (Tenant::TenantA, $ hasTenantA ->property ->tenant );
24- $ this ->assertContains (Tenant::TenantA, $ stack );
2522
2623 $ hasTenantB = $ container ->make (ContainerTestHasTenantImplPropertyWithTenantB::class);
2724 $ this ->assertInstanceOf (HasTenantImpl::class, $ hasTenantB ->property );
2825 $ this ->assertEquals (Tenant::TenantB, $ hasTenantB ->property ->tenant );
29- $ this ->assertContains (Tenant::TenantB, $ stack );
3026 }
3127
3228 public function testCallbackIsCalledAfterClassWithAttributeIsResolved ()
@@ -61,19 +57,6 @@ public function testCallbackIsCalledAfterClassWithConstructorAndAttributeIsResol
6157 $ this ->assertInstanceOf (ContainerTestHasSelfConfiguringAttributeAndConstructor::class, $ instance );
6258 $ this ->assertEquals ('the-right-value ' , $ instance ->value );
6359 }
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- }
7760}
7861
7962#[Attribute(Attribute::TARGET_PARAMETER )]
@@ -83,11 +66,6 @@ public function __construct(
8366 public readonly Tenant $ tenant
8467 ) {
8568 }
86-
87- public function after (self $ attribute , HasTenantImpl $ class , Container $ container ): void
88- {
89- $ class ->onTenant ($ attribute ->tenant );
90- }
9169}
9270
9371enum Tenant
0 commit comments