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
61
61
$ endpoint = (string ) $ config ['host ' ];
62
62
}
63
63
if (isset ($ config ['port ' ])) {
64
- $ endpoint .= (string ) $ config ['port ' ];
64
+ $ endpoint .= ' : ' . (string ) $ config ['port ' ];
65
65
}
66
66
67
67
return $ endpoint ;
Original file line number Diff line number Diff line change @@ -21,6 +21,16 @@ class HttpClientConfig extends DataTransferObject
21
21
*/
22
22
public string $ endpoint = 'http://localhost:8529 ' ;
23
23
24
+ /**
25
+ * @var string|null
26
+ */
27
+ public ?string $ host = null ;
28
+
29
+ /**
30
+ * @var string|int|null
31
+ */
32
+ public $ port = null ;
33
+
24
34
/**
25
35
* @var float|int
26
36
*/
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public function testGetConfig()
21
21
{
22
22
$ defaultConfig = [
23
23
'endpoint ' => 'http://localhost:8529 ' ,
24
+ 'host ' => null ,
25
+ 'port ' => null ,
24
26
'version ' => 1.1 ,
25
27
'connection ' => 'Keep-Alive ' ,
26
28
'allow_redirects ' => false ,
@@ -34,6 +36,18 @@ public function testGetConfig()
34
36
$ this ->assertSame ($ defaultConfig , $ config );
35
37
}
36
38
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
+ }
37
51
38
52
public function testSetAndGetHttpClient ()
39
53
{
Original file line number Diff line number Diff line change @@ -107,4 +107,16 @@ public function testCommit()
107
107
$ this ->arangoClient ->schema ()->deleteCollection ('Users ' );
108
108
$ this ->arangoClient ->schema ()->deleteCollection ('Customers ' );
109
109
}
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
+ }
110
122
}
You can’t perform that action at this time.
0 commit comments