77namespace Neo4j \Neo4jBundle \Tests \Functional ;
88
99use Laudis \Neo4j \Client ;
10+ use Laudis \Neo4j \Common \DriverSetupManager ;
1011use Laudis \Neo4j \Common \SingleThreadedSemaphore ;
1112use Laudis \Neo4j \Contracts \ClientInterface ;
1213use Laudis \Neo4j \Contracts \DriverInterface ;
1314use Laudis \Neo4j \Databags \ConnectionRequestData ;
15+ use Laudis \Neo4j \Databags \DriverSetup ;
1416use Laudis \Neo4j \Databags \SslConfiguration ;
1517use Laudis \Neo4j \Enum \SslMode ;
1618use Laudis \Neo4j \Neo4j \Neo4jConnectionPool ;
1719use Laudis \Neo4j \Neo4j \Neo4jDriver ;
20+ use Neo4j \Neo4jBundle \SymfonyClient ;
1821use Neo4j \Neo4jBundle \Tests \App \TestKernel ;
1922use Psr \Http \Message \UriInterface ;
2023use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
@@ -100,6 +103,31 @@ public function testDsn(): void
100103 $ client ->getDriver ('neo4j_undefined_configs ' );
101104 }
102105
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+
103131 public function testDefaultDriverConfig (): void
104132 {
105133 static ::bootKernel ();
@@ -153,7 +181,7 @@ public function testDefaultSessionConfig(): void
153181 $ this ->assertSame ($ sessionConfig ->getFetchSize (), 999 );
154182 }
155183
156- public function testDefaultTrasactionConfig (): void
184+ public function testDefaultTransactionConfig (): void
157185 {
158186 static ::bootKernel ();
159187 $ container = static ::getContainer ();
@@ -169,6 +197,30 @@ public function testDefaultTrasactionConfig(): void
169197 $ this ->assertSame ($ transactionConfig ->getTimeout (), 40.0 );
170198 }
171199
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+
172224 /**
173225 * @template T
174226 *
0 commit comments