File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 13
13
14
14
namespace Laudis \Neo4j \Tests \Integration ;
15
15
16
+ use Bolt \error \MessageException ;
16
17
use Generator ;
18
+ use Laudis \Neo4j \Basic \Driver ;
19
+ use Throwable ;
17
20
use function getenv ;
18
21
use InvalidArgumentException ;
19
22
use Laudis \Neo4j \ClientBuilder ;
@@ -470,6 +473,24 @@ public function testTimeoutRecovery(string $alias): void
470
473
$ tsx ->run ('CALL apoc.util.sleep(20000) ' );
471
474
}
472
475
476
+ /**
477
+ * @dataProvider connectionAliases
478
+ */
479
+ public function testConstraintHandling (string $ alias ): void
480
+ {
481
+ $ session = $ this ->getClient ()->getDriver ($ alias )->createSession ();
482
+
483
+ $ session ->run ("CREATE (test:Test{id: '123'}) " );
484
+ try {
485
+ $ session ->run ('CREATE CONSTRAINT ON (test:Test) ASSERT test.id IS UNIQUE ' );
486
+ } catch (Throwable $ e ) {
487
+ // We cannot use IF EXISTS on version 4.0
488
+ $ session ->run ('DROP CONSTRAINT ON (test:Test) ASSERT test.id IS UNIQUE ' );
489
+ }
490
+ $ this ->expectException (MessageException::class);
491
+ $ session ->run ("CREATE (test:Test {id: '123'}) RETURN test " );
492
+ }
493
+
473
494
/**
474
495
* @dataProvider connectionAliases
475
496
*/
You can’t perform that action at this time.
0 commit comments