1919use Laudis \Neo4j \Contracts \FormatterInterface ;
2020use Laudis \Neo4j \Contracts \TransactionInterface ;
2121use Laudis \Neo4j \Databags \Statement ;
22+ use Laudis \Neo4j \Databags \SummarizedResult ;
2223use Laudis \Neo4j \Exception \Neo4jException ;
23- use Laudis \Neo4j \Formatter \BasicFormatter ;
24+ use Laudis \Neo4j \Formatter \SummarizedResultFormatter ;
25+ use Laudis \Neo4j \Types \CypherMap ;
2426
2527/**
26- * @psalm-import-type BasicResults from \Laudis\Neo4j\Formatter\BasicFormatter
28+ * @psalm-import-type OGMTypes from \Laudis\Neo4j\Formatter\OGMFormatter
2729 *
28- * @extends EnvironmentAwareIntegrationTest<BasicResults >
30+ * @extends EnvironmentAwareIntegrationTest<SummarizedResult<CypherMap<OGMTypes>> >
2931 */
3032final class ClientIntegrationTest extends EnvironmentAwareIntegrationTest
3133{
32- protected function formatter (): FormatterInterface
34+ protected static function formatter (): FormatterInterface
3335 {
34- /** @psalm-suppress InvalidReturnStatement */
35- return new BasicFormatter ();
36+ return SummarizedResultFormatter::create ();
3637 }
3738
3839 public function testEqualEffect (): void
@@ -48,8 +49,8 @@ public function testEqualEffect(): void
4849 $ prev = null ;
4950 foreach ($ this ->connectionAliases () as $ current ) {
5051 if ($ prev !== null ) {
51- $ x = $ this ->client ->runStatement ($ statement , $ prev );
52- $ y = $ this ->client ->runStatement ($ statement , $ current [0 ]);
52+ $ x = $ this ->getClient () ->runStatement ($ statement , $ prev );
53+ $ y = $ this ->getClient () ->runStatement ($ statement , $ current [0 ]);
5354
5455 self ::assertEquals ($ x , $ y );
5556 self ::assertEquals ($ x ->toArray (), $ y ->toArray ());
@@ -63,7 +64,7 @@ public function testEqualEffect(): void
6364 */
6465 public function testAvailabilityFullImplementation (string $ alias ): void
6566 {
66- $ results = $ this ->client ->getDriver ($ alias )
67+ $ results = $ this ->getClient () ->getDriver ($ alias )
6768 ->createSession ()
6869 ->beginTransaction ()
6970 ->run ('UNWIND [1] AS x RETURN x ' )
@@ -78,20 +79,20 @@ public function testAvailabilityFullImplementation(string $alias): void
7879 */
7980 public function testTransactionFunction (string $ alias ): void
8081 {
81- $ result = $ this ->client ->transaction (static function (TransactionInterface $ tsx ) {
82- return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->get ('x ' );
82+ $ result = $ this ->getClient () ->transaction (static function (TransactionInterface $ tsx ) {
83+ return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->getAsInt ('x ' );
8384 }, $ alias );
8485
8586 self ::assertEquals (1 , $ result );
8687
87- $ result = $ this ->client ->readTransaction (static function (TransactionInterface $ tsx ) {
88- return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->get ('x ' );
88+ $ result = $ this ->getClient () ->readTransaction (static function (TransactionInterface $ tsx ) {
89+ return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->getAsInt ('x ' );
8990 }, $ alias );
9091
9192 self ::assertEquals (1 , $ result );
9293
93- $ result = $ this ->client ->writeTransaction (static function (TransactionInterface $ tsx ) {
94- return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->get ('x ' );
94+ $ result = $ this ->getClient () ->writeTransaction (static function (TransactionInterface $ tsx ) {
95+ return $ tsx ->run ('UNWIND [1] AS x RETURN x ' )->first ()->getAsInt ('x ' );
9596 }, $ alias );
9697
9798 self ::assertEquals (1 , $ result );
@@ -102,7 +103,7 @@ public function testTransactionFunction(string $alias): void
102103 */
103104 public function testValidRun (string $ alias ): void
104105 {
105- $ response = $ this ->client ->run (<<<'CYPHER'
106+ $ response = $ this ->getClient () ->run (<<<'CYPHER'
106107MERGE (x:TestNode {test: $test})
107108WITH x
108109MERGE (y:OtherTestNode {test: $otherTest})
@@ -127,7 +128,7 @@ public function testInvalidRun(string $alias): void
127128 {
128129 $ exception = false ;
129130 try {
130- $ this ->client ->run ('MERGE (x:Tes0342hdm21.()) ' , ['test ' => 'a ' , 'otherTest ' => 'b ' ], $ alias );
131+ $ this ->getClient () ->run ('MERGE (x:Tes0342hdm21.()) ' , ['test ' => 'a ' , 'otherTest ' => 'b ' ], $ alias );
131132 } catch (Neo4jException $ e ) {
132133 $ exception = true ;
133134 }
@@ -139,7 +140,7 @@ public function testInvalidRun(string $alias): void
139140 */
140141 public function testValidStatement (string $ alias ): void
141142 {
142- $ response = $ this ->client ->runStatement (
143+ $ response = $ this ->getClient () ->runStatement (
143144 Statement::create (<<<'CYPHER'
144145MERGE (x:TestNode {test: $test})
145146WITH x
@@ -168,7 +169,7 @@ public function testInvalidStatement(string $alias): void
168169 $ exception = false ;
169170 try {
170171 $ statement = Statement::create ('MERGE (x:Tes0342hdm21.()) ' , ['test ' => 'a ' , 'otherTest ' => 'b ' ]);
171- $ this ->client ->runStatement ($ statement , $ alias );
172+ $ this ->getClient () ->runStatement ($ statement , $ alias );
172173 } catch (Neo4jException $ e ) {
173174 $ exception = true ;
174175 }
@@ -181,7 +182,7 @@ public function testInvalidStatement(string $alias): void
181182 public function testStatements (string $ alias ): void
182183 {
183184 $ params = ['test ' => 'a ' , 'otherTest ' => 'b ' ];
184- $ response = $ this ->client ->runStatements ([
185+ $ response = $ this ->getClient () ->runStatements ([
185186 Statement::create (<<<'CYPHER'
186187MERGE (x:TestNode {test: $test})
187188CYPHER,
@@ -215,7 +216,7 @@ public function testInvalidStatements(string $alias): void
215216 {
216217 $ this ->expectException (Neo4jException::class);
217218 $ params = ['test ' => 'a ' , 'otherTest ' => 'b ' ];
218- $ this ->client ->runStatements ([
219+ $ this ->getClient () ->runStatements ([
219220 Statement::create (<<<'CYPHER'
220221MERGE (x:TestNode {test: $test})
221222CYPHER,
@@ -235,8 +236,8 @@ public function testInvalidStatements(string $alias): void
235236 */
236237 public function testMultipleTransactions (string $ alias ): void
237238 {
238- $ x = $ this ->client ->beginTransaction (null , $ alias );
239- $ y = $ this ->client ->beginTransaction (null , $ alias );
239+ $ x = $ this ->getClient () ->beginTransaction (null , $ alias );
240+ $ y = $ this ->getClient () ->beginTransaction (null , $ alias );
240241 self ::assertNotSame ($ x , $ y );
241242 $ x ->rollback ();
242243 $ y ->rollback ();
@@ -247,7 +248,7 @@ public function testInvalidConnection(): void
247248 $ this ->expectException (InvalidArgumentException::class);
248249 $ this ->expectExceptionMessage ('The provided alias: "ghqkneq;tr" was not found in the client ' );
249250
250- $ this ->client ->run ('RETURN 1 AS x ' , [], 'ghqkneq;tr ' );
251+ $ this ->getClient () ->run ('RETURN 1 AS x ' , [], 'ghqkneq;tr ' );
251252 }
252253
253254 public function testInvalidConnectionCheck (): void
@@ -268,6 +269,6 @@ public function testInvalidConnectionCheck(): void
268269 */
269270 public function testValidConnectionCheck (string $ alias ): void
270271 {
271- self ::assertTrue ($ this ->client ->verifyConnectivity ($ alias ));
272+ self ::assertTrue ($ this ->getClient () ->verifyConnectivity ($ alias ));
272273 }
273274}
0 commit comments