From 14d43e9a073aac468231404f87bc07447948830a Mon Sep 17 00:00:00 2001 From: marijnvanwezel Date: Thu, 8 Dec 2022 22:58:12 +0100 Subject: [PATCH] Add pattern clause examples tests --- tests/end-to-end/ExamplesTest.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/end-to-end/ExamplesTest.php b/tests/end-to-end/ExamplesTest.php index a561eaa..b87bb3f 100644 --- a/tests/end-to-end/ExamplesTest.php +++ b/tests/end-to-end/ExamplesTest.php @@ -101,4 +101,34 @@ public function testCallProcedureClauseExample3(): void $this->assertSame("CALL `dbms.security.createUser`('example_username', 'example_password', false)", $statement); } + + public function testCreateClauseExample1(): void + { + $query = Query::new() + ->create(Query::node("Person")) + ->build(); + + $this->assertSame("CREATE (:Person)", $query); + } + + public function testCreateClauseExample2(): void + { + $query = Query::new() + ->create(Query::node("Person")->withVariable('n')->withProperties([ + 'name' => 'Marijn', + 'title' => 'Maintainer' + ])) + ->build(); + + $this->assertSame("CREATE (n:Person {name: 'Marijn', title: 'Maintainer'})", $query); + } + + public function testCreateClauseExample3(): void + { + $query = Query::new() + ->create([Query::node("Person"), Query::node("Animal")]) + ->build(); + + $this->assertSame("CREATE (:Person), (:Animal)", $query); + } }