Skip to content

Commit 01367e9

Browse files
Add tests for CALL procedure examples
1 parent a1205db commit 01367e9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/end-to-end/ExamplesTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace WikibaseSolutions\CypherDSL\Tests\EndToEnd;
1111

1212
use PHPUnit\Framework\TestCase;
13+
use WikibaseSolutions\CypherDSL\Expressions\Procedures\Procedure;
1314
use WikibaseSolutions\CypherDSL\Query;
1415

1516
/**
@@ -69,4 +70,35 @@ public function testCallSubqueryClauseExample3(): void
6970

7071
$this->assertStringMatchesFormat("MATCH (%s:Person) CALL { WITH %s REMOVE %s:Person }", $query);
7172
}
73+
74+
public function testCallProcedureClauseExample1(): void
75+
{
76+
$statement = Query::new()
77+
->callProcedure("apoc.json")
78+
->build();
79+
80+
$this->assertSame("CALL `apoc.json`()", $statement);
81+
}
82+
83+
public function testCallProcedureClauseExample2(): void
84+
{
85+
$statement = Query::new()
86+
->callProcedure("dbms.procedures", [
87+
Query::variable('name'),
88+
Query::variable('signature')
89+
])
90+
->build();
91+
92+
$this->assertSame("CALL `dbms.procedures`() YIELD name, signature", $statement);
93+
}
94+
95+
public function testCallProcedureClauseExample3(): void
96+
{
97+
$procedure = Procedure::raw("dbms.security.createUser", ['example_username', 'example_password', false]);
98+
$statement = Query::new()
99+
->callProcedure($procedure)
100+
->build();
101+
102+
$this->assertSame("CALL `dbms.security.createUser`('example_username', 'example_password', false)", $statement);
103+
}
72104
}

0 commit comments

Comments
 (0)