From 9721043a83856a13a0644719c9973f9a756cf778 Mon Sep 17 00:00:00 2001 From: Marijn van Wezel Date: Sun, 1 Jan 2023 23:24:47 +0100 Subject: [PATCH] Add tests for where --- tests/end-to-end/ExamplesTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/end-to-end/ExamplesTest.php b/tests/end-to-end/ExamplesTest.php index 338b330..fa75a78 100644 --- a/tests/end-to-end/ExamplesTest.php +++ b/tests/end-to-end/ExamplesTest.php @@ -691,6 +691,30 @@ public function testSkipClauseExample3(): void $this->assertStringMatchesFormat("MATCH (%s) RETURN %s.name ORDER BY %s.name SKIP (5 ^ 2)", $query); } + public function testWhereClauseExample1(): void + { + $n = node('Person'); + $query = query() + ->match($n) + ->where($n->property('name')->equals('Peter')) + ->returning($n) + ->build(); + + $this->assertStringMatchesFormat("MATCH (%s:Person) WHERE (%s.name = 'Peter') RETURN %s", $query); + } + + public function testWhereClauseExample2(): void + { + $n = node(); + $query = query() + ->match($n) + ->where($n->labeled('Person')) + ->returning($n) + ->build(); + + $this->assertStringMatchesFormat("MATCH (%s) WHERE %s:Person RETURN %s", $query); + } + public function testCombiningClausesExample1(): void { $nineties = node("Movie");