Skip to content

Commit

Permalink
Add pattern clause examples tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnvanwezel committed Dec 8, 2022
1 parent 01367e9 commit 14d43e9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/end-to-end/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 14d43e9

Please sign in to comment.