1818
1919final class FactoryTest extends TestCase
2020{
21- public function testCreate ()
21+ public function testcreateContainer ()
2222 {
2323 $ loop = LoopFactory::create ();
2424
2525 $ stdClass = new \stdClass ();
2626 $ stdClass ->foo = 'bar ' ;
2727
28- $ client = Factory::create (
28+ $ container = Factory::createContainer (
2929 $ loop ,
3030 [
3131 Options::HYDRATOR_OPTIONS => [],
@@ -36,16 +36,37 @@ public function testCreate()
3636 ]
3737 );
3838
39- $ this ->assertInstanceOf (Client::class, $ client );
40-
41- $ container = $ client ->getContainer ();
4239 $ this ->assertInstanceOf (LoopInterface::class, $ container ->get (LoopInterface::class));
4340 $ this ->assertSame ($ loop , $ container ->get (LoopInterface::class));
4441 $ this ->assertInstanceOf (Hydrator::class, $ container ->get (Hydrator::class));
4542 $ this ->assertInstanceOf (TransportClient::class, $ container ->get (ClientInterface::class));
4643 $ this ->assertInstanceOf (\stdClass::class, $ container ->get (\stdClass::class));
4744 $ this ->assertSame ($ stdClass , $ container ->get (\stdClass::class));
4845 $ this ->assertSame ('bar ' , $ container ->get (\stdClass::class)->foo );
46+ }
47+
48+ public function testCreate ()
49+ {
50+ $ loop = LoopFactory::create ();
51+
52+ $ stdClass = new \stdClass ();
53+ $ stdClass ->foo = 'bar ' ;
54+
55+ $ client = Factory::create (
56+ $ loop ,
57+ [
58+ Options::HYDRATOR_OPTIONS => [],
59+ Options::TRANSPORT_OPTIONS => [
60+ TransportOptions::USER_AGENT => 'User Agent ' ,
61+ ],
62+ Options::TRANSPORT_OPTIONS => [
63+ TransportOptions::USER_AGENT => '' ,
64+ ],
65+ Options::CONTAINER_DEFINITIONS => [
66+ \stdClass::class => $ stdClass ,
67+ ],
68+ ]
69+ );
4970
5071 try {
5172 await ($ client ->handle (new class () {
@@ -63,12 +84,12 @@ public function testCreate()
6384 */
6485 public function testCreateMissingHydratorOptions ()
6586 {
66- Factory::create (
87+ Factory::createContainer (
6788 LoopFactory::create (),
6889 [
6990 Options::TRANSPORT_OPTIONS => [],
7091 ]
71- )->getContainer ()-> get (Hydrator::class);
92+ )->get (Hydrator::class);
7293 }
7394
7495 /**
@@ -77,11 +98,11 @@ public function testCreateMissingHydratorOptions()
7798 */
7899 public function testCreateMissingTransportOptions ()
79100 {
80- Factory::create (
101+ Factory::createContainer (
81102 LoopFactory::create (),
82103 [
83104 Options::HYDRATOR_OPTIONS => [],
84105 ]
85- )->getContainer ()-> get (ClientInterface::class);
106+ )->get (ClientInterface::class);
86107 }
87108}
0 commit comments