Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 6e9c867

Browse files
authored
Merge pull request #5 from reactphp-parallel/add-getter-for-the-proxy-on-the-container-proxy
Add getter for the container proxy
2 parents 580ff70 + da749e6 commit 6e9c867

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/ContainerProxy.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ public function create(ContainerInterface $container): ContainerInterface
2424
{
2525
return new ThreadContainerProxy($container, $this->proxy);
2626
}
27+
28+
public function proxy(): ContainerInterface
29+
{
30+
return $this->proxy;
31+
}
2732
}

tests/ContainerProxyTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use React\EventLoop\Factory as EventLoopFactory;
88
use ReactParallel\Factory;
9+
use ReactParallel\ObjectProxy\Generated\Psr__Container_ContainerInterfaceProxy;
910
use ReactParallel\ObjectProxy\Proxy;
1011
use ReactParallel\Psr11ContainerProxy\ContainerProxy;
1112
use ReactParallel\Psr11ContainerProxy\ThreadContainerProxy;
@@ -26,4 +27,17 @@ public function create(): void
2627

2728
self::assertInstanceOf(ThreadContainerProxy::class, $containerProxy->create(new Container()));
2829
}
30+
31+
/**
32+
* @test
33+
*/
34+
public function proxy(): void
35+
{
36+
$loop = EventLoopFactory::create();
37+
$factory = new Factory($loop);
38+
$proxy = new Proxy($factory);
39+
$containerProxy = new ContainerProxy(new Container(), $proxy);
40+
41+
self::assertInstanceOf(Psr__Container_ContainerInterfaceProxy::class, $containerProxy->proxy());
42+
}
2943
}

0 commit comments

Comments
 (0)