Skip to content

Commit 3da1d2e

Browse files
committed
added call method query acceptance test
1 parent 6f36d96 commit 3da1d2e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/Unit/QueryTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ public function testAutomaticIdentifierGeneration(): void
10481048
$this->assertInstanceOf(Variable::class, $node->getName());
10491049
}
10501050

1051-
public function testCall(): void
1051+
public function testCallCallable(): void
10521052
{
10531053
$node = Query::node('X')->named('y');
10541054
$query = Query::new()->match($node)
@@ -1062,6 +1062,22 @@ public function testCall(): void
10621062
$this->assertEquals("MATCH (y:X) CALL { WITH y WHERE y.z = 'foo' RETURN y.z AS foo } RETURN foo", $query->toQuery());
10631063
}
10641064

1065+
public function testCallClause(): void {
1066+
1067+
$node = Query::node('X')->named('y');
1068+
1069+
$sub = Query::new()->with($node->getVariable())
1070+
->where($node->property('z')->equals(Query::literal('foo'), false))
1071+
->returning($node->property('z')->alias('foo'));
1072+
1073+
$query = Query::new()
1074+
->match($node)
1075+
->call($sub)
1076+
->returning(Query::variable('foo'));
1077+
1078+
$this->assertEquals("MATCH (y:X) CALL { WITH y WHERE y.z = 'foo' RETURN y.z AS foo } RETURN foo", $query->toQuery());
1079+
}
1080+
10651081
public function provideLiteralData(): array
10661082
{
10671083
return [

0 commit comments

Comments
 (0)