1919
2020final class FactoryTest extends TestCase
2121{
22- public function testCreate ()
22+ public function testcreateContainer ()
2323 {
2424 $ loop = LoopFactory::create ();
2525
2626 $ stdClass = new \stdClass ();
2727 $ stdClass ->foo = 'bar ' ;
2828
29- $ client = Factory::create (
29+ $ container = Factory::createContainer (
3030 $ loop ,
3131 [
3232 Options::HYDRATOR_OPTIONS => [],
@@ -42,16 +42,37 @@ public function testCreate()
4242 ]
4343 );
4444
45- $ this ->assertInstanceOf (Client::class, $ client );
46-
47- $ container = $ client ->getContainer ();
4845 $ this ->assertInstanceOf (LoopInterface::class, $ container ->get (LoopInterface::class));
4946 $ this ->assertSame ($ loop , $ container ->get (LoopInterface::class));
5047 $ this ->assertInstanceOf (Hydrator::class, $ container ->get (Hydrator::class));
5148 $ this ->assertInstanceOf (TransportClient::class, $ container ->get (ClientInterface::class));
5249 $ this ->assertInstanceOf (\stdClass::class, $ container ->get (\stdClass::class));
5350 $ this ->assertSame ($ stdClass , $ container ->get (\stdClass::class));
5451 $ this ->assertSame ('bar ' , $ container ->get (\stdClass::class)->foo );
52+ }
53+
54+ public function testCreate ()
55+ {
56+ $ loop = LoopFactory::create ();
57+
58+ $ stdClass = new \stdClass ();
59+ $ stdClass ->foo = 'bar ' ;
60+
61+ $ client = Factory::create (
62+ $ loop ,
63+ [
64+ Options::HYDRATOR_OPTIONS => [],
65+ Options::TRANSPORT_OPTIONS => [
66+ TransportOptions::USER_AGENT => 'User Agent ' ,
67+ ],
68+ Options::TRANSPORT_OPTIONS => [
69+ TransportOptions::USER_AGENT => '' ,
70+ ],
71+ Options::CONTAINER_DEFINITIONS => [
72+ \stdClass::class => $ stdClass ,
73+ ],
74+ ]
75+ );
5576
5677 try {
5778 await ($ client ->handle (new class () {}), $ loop );
@@ -69,12 +90,12 @@ public function testCreate()
6990 */
7091 public function testCreateMissingHydratorOptions ()
7192 {
72- Factory::create (
93+ Factory::createContainer (
7394 LoopFactory::create (),
7495 [
7596 Options::TRANSPORT_OPTIONS => [],
7697 ]
77- )->getContainer ()-> get (Hydrator::class);
98+ )->get (Hydrator::class);
7899 }
79100
80101 /**
@@ -83,11 +104,11 @@ public function testCreateMissingHydratorOptions()
83104 */
84105 public function testCreateMissingTransportOptions ()
85106 {
86- Factory::create (
107+ Factory::createContainer (
87108 LoopFactory::create (),
88109 [
89110 Options::HYDRATOR_OPTIONS => [],
90111 ]
91- )->getContainer ()-> get (ClientInterface::class);
112+ )->get (ClientInterface::class);
92113 }
93114}
0 commit comments