7
7
namespace Neo4j \Neo4jBundle \Tests \Functional ;
8
8
9
9
use Laudis \Neo4j \Client ;
10
+ use Laudis \Neo4j \Common \DriverSetupManager ;
10
11
use Laudis \Neo4j \Common \SingleThreadedSemaphore ;
11
12
use Laudis \Neo4j \Contracts \ClientInterface ;
12
13
use Laudis \Neo4j \Contracts \DriverInterface ;
13
14
use Laudis \Neo4j \Databags \ConnectionRequestData ;
15
+ use Laudis \Neo4j \Databags \DriverSetup ;
14
16
use Laudis \Neo4j \Databags \SslConfiguration ;
15
17
use Laudis \Neo4j \Enum \SslMode ;
16
18
use Laudis \Neo4j \Neo4j \Neo4jConnectionPool ;
17
19
use Laudis \Neo4j \Neo4j \Neo4jDriver ;
20
+ use Neo4j \Neo4jBundle \SymfonyClient ;
18
21
use Neo4j \Neo4jBundle \Tests \App \TestKernel ;
19
22
use Psr \Http \Message \UriInterface ;
20
23
use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
@@ -100,6 +103,31 @@ public function testDsn(): void
100
103
$ client ->getDriver ('neo4j_undefined_configs ' );
101
104
}
102
105
106
+ public function testDriverAuthentication (): void
107
+ {
108
+ static ::bootKernel ();
109
+ $ container = static ::getContainer ();
110
+
111
+ /**
112
+ * @var ClientInterface $client
113
+ */
114
+ $ client = $ container ->get ('neo4j.client ' );
115
+ /** @var Neo4jDriver $driver */
116
+ $ driver = $ client ->getDriver ('neo4j-auth ' );
117
+ /** @var Neo4jConnectionPool $pool */
118
+ $ pool = $ this ->getPrivateProperty ($ driver , 'pool ' );
119
+ /** @var ConnectionRequestData $data */
120
+ $ data = $ this ->getPrivateProperty ($ pool , 'data ' );
121
+ $ auth = $ data ->getAuth ();
122
+ /** @var string $username */
123
+ $ username = $ this ->getPrivateProperty ($ auth , 'username ' );
124
+ /** @var string $password */
125
+ $ password = $ this ->getPrivateProperty ($ auth , 'password ' );
126
+
127
+ $ this ->assertSame ($ username , 'neo4j ' );
128
+ $ this ->assertSame ($ password , 'testtest ' );
129
+ }
130
+
103
131
public function testDefaultDriverConfig (): void
104
132
{
105
133
static ::bootKernel ();
@@ -153,7 +181,7 @@ public function testDefaultSessionConfig(): void
153
181
$ this ->assertSame ($ sessionConfig ->getFetchSize (), 999 );
154
182
}
155
183
156
- public function testDefaultTrasactionConfig (): void
184
+ public function testDefaultTransactionConfig (): void
157
185
{
158
186
static ::bootKernel ();
159
187
$ container = static ::getContainer ();
@@ -169,6 +197,30 @@ public function testDefaultTrasactionConfig(): void
169
197
$ this ->assertSame ($ transactionConfig ->getTimeout (), 40.0 );
170
198
}
171
199
200
+ public function testPriority (): void
201
+ {
202
+ static ::bootKernel ();
203
+ $ container = static ::getContainer ();
204
+
205
+ /**
206
+ * @var ClientInterface $client
207
+ */
208
+ $ client = $ container ->get ('neo4j.client ' );
209
+ /** @var Client $innerClient */
210
+ $ innerClient = $ this ->getPrivateProperty ($ client , 'client ' );
211
+ /** @var DriverSetupManager $drivers */
212
+ $ drivers = $ this ->getPrivateProperty ($ innerClient , 'driverSetups ' );
213
+ /** @var array<\SplPriorityQueue<int, DriverSetup>> $fallbackDriverQueue */
214
+ $ driverSetups = $ this ->getPrivateProperty ($ drivers , 'driverSetups ' );
215
+ /** @var \SplPriorityQueue<int, DriverSetup> $fallbackDriverQueue */
216
+ $ fallbackDriverQueue = $ driverSetups ['neo4j-fallback-mechanism ' ];
217
+ $ fallbackDriverQueue ->setExtractFlags (\SplPriorityQueue::EXTR_BOTH );
218
+ /** @var array{data: DriverSetup, priority: int} $extractedValue */
219
+ $ extractedValue = $ fallbackDriverQueue ->extract ();
220
+
221
+ $ this ->assertSame ($ extractedValue ['priority ' ], 1000 );
222
+ }
223
+
172
224
/**
173
225
* @template T
174
226
*
0 commit comments