File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function generateEndpoint(array $config): string
6161 $ endpoint = (string ) $ config ['host ' ];
6262 }
6363 if (isset ($ config ['port ' ])) {
64- $ endpoint .= (string ) $ config ['port ' ];
64+ $ endpoint .= ' : ' . (string ) $ config ['port ' ];
6565 }
6666
6767 return $ endpoint ;
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ class HttpClientConfig extends DataTransferObject
2121 */
2222 public string $ endpoint = 'http://localhost:8529 ' ;
2323
24+ /**
25+ * @var string|null
26+ */
27+ public ?string $ host = null ;
28+
29+ /**
30+ * @var string|int|null
31+ */
32+ public $ port = null ;
33+
2434 /**
2535 * @var float|int
2636 */
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public function testGetConfig()
2121 {
2222 $ defaultConfig = [
2323 'endpoint ' => 'http://localhost:8529 ' ,
24+ 'host ' => null ,
25+ 'port ' => null ,
2426 'version ' => 1.1 ,
2527 'connection ' => 'Keep-Alive ' ,
2628 'allow_redirects ' => false ,
@@ -34,6 +36,18 @@ public function testGetConfig()
3436 $ this ->assertSame ($ defaultConfig , $ config );
3537 }
3638
39+ public function testClientWithHostPortConfig ()
40+ {
41+ $ config = [
42+ 'host ' => 'http://127.0.0.1 ' ,
43+ 'port ' => '1234 ' ,
44+ 'username ' => 'root ' ,
45+ ];
46+ $ client = new ArangoClient ($ config );
47+ $ retrievedConfig = $ client ->getConfig ();
48+
49+ $ this ->assertEquals ('http://127.0.0.1:1234 ' , $ retrievedConfig ['endpoint ' ]);
50+ }
3751
3852 public function testSetAndGetHttpClient ()
3953 {
Original file line number Diff line number Diff line change @@ -107,4 +107,16 @@ public function testCommit()
107107 $ this ->arangoClient ->schema ()->deleteCollection ('Users ' );
108108 $ this ->arangoClient ->schema ()->deleteCollection ('Customers ' );
109109 }
110+
111+ public function testTransactionManagerSetterAndGetter ()
112+ {
113+ $ oldTransactionManager = $ this ->arangoClient ->getTransactionManager ();
114+ $ newTransactionManager = new TransactionManager ($ this ->arangoClient );
115+ $ this ->arangoClient ->setTransactionManager ($ newTransactionManager );
116+ $ retrievedNewTransactionManager = $ this ->arangoClient ->getTransactionManager ();
117+
118+ $ this ->assertNull ($ oldTransactionManager );
119+ $ this ->assertEquals (spl_object_id ($ newTransactionManager ), spl_object_id ($ retrievedNewTransactionManager ));
120+
121+ }
110122}
You can’t perform that action at this time.
0 commit comments