File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 17
17
use function getenv ;
18
18
use InvalidArgumentException ;
19
19
use Laudis \Neo4j \Contracts \FormatterInterface ;
20
+ use Laudis \Neo4j \Exception \Neo4jException ;
20
21
use Laudis \Neo4j \Formatter \BasicFormatter ;
21
22
use Laudis \Neo4j \ParameterHelper ;
23
+ use function str_starts_with ;
22
24
23
25
/**
24
26
* @psalm-import-type BasicResults from \Laudis\Neo4j\Formatter\BasicFormatter
@@ -238,4 +240,28 @@ public function testPeriodicCommit(string $alias): void
238
240
$ result = $ this ->client ->run ('MATCH (n:File) RETURN count(n) AS count ' );
239
241
self ::assertEquals (20 , $ result ->first ()->get ('count ' ));
240
242
}
243
+
244
+ /**
245
+ * @dataProvider connectionAliases
246
+ */
247
+ public function testPeriodicCommitFail (string $ alias ): void
248
+ {
249
+ if (getenv ('TESTING_ENVIRONMENT ' ) !== 'local ' ) {
250
+ self ::markTestSkipped ('Only local environment has access to local files ' );
251
+ }
252
+
253
+ if (str_starts_with ($ alias , 'http ' )) {
254
+ self ::markTestSkipped ('HTTP allows periodic commits during an actual transaction ' );
255
+ }
256
+
257
+ $ this ->expectException (Neo4jException::class);
258
+
259
+ $ tsx = $ this ->client ->beginTransaction ([], $ alias );
260
+ $ tsx ->run (<<<CYPHER
261
+ USING PERIODIC COMMIT 10
262
+ LOAD CSV FROM 'file:///csv-example.csv' AS line
263
+ MERGE (n:File {name: line[0]});
264
+ CYPHER );
265
+ $ tsx ->commit ();
266
+ }
241
267
}
You can’t perform that action at this time.
0 commit comments