|
10 | 10 | namespace WikibaseSolutions\CypherDSL\Tests\EndToEnd;
|
11 | 11 |
|
12 | 12 | use PHPUnit\Framework\TestCase;
|
| 13 | +use WikibaseSolutions\CypherDSL\Expressions\Procedures\Procedure; |
13 | 14 | use WikibaseSolutions\CypherDSL\Query;
|
14 | 15 |
|
15 | 16 | /**
|
@@ -69,4 +70,35 @@ public function testCallSubqueryClauseExample3(): void
|
69 | 70 |
|
70 | 71 | $this->assertStringMatchesFormat("MATCH (%s:Person) CALL { WITH %s REMOVE %s:Person }", $query);
|
71 | 72 | }
|
| 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 | + } |
72 | 104 | }
|
0 commit comments