Skip to content

Commit a92eaff

Browse files
committed
Add test cases for CALL and TRUNCATE statements
Signed-off-by: William Desportes <[email protected]>
1 parent a580bbe commit a92eaff

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

tests/Builder/CallStatementTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace PhpMyAdmin\SqlParser\Tests\Builder;
4+
5+
use PhpMyAdmin\SqlParser\Parser;
6+
use PhpMyAdmin\SqlParser\Tests\TestCase;
7+
8+
class CallStatementTest extends TestCase
9+
{
10+
public function testBuilder()
11+
{
12+
$query = 'CALL foo()';
13+
14+
$parser = new Parser($query);
15+
$stmt = $parser->statements[0];
16+
17+
$this->assertEquals($query, $stmt->build());
18+
}
19+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace PhpMyAdmin\SqlParser\Tests\Builder;
4+
5+
use PhpMyAdmin\SqlParser\Parser;
6+
use PhpMyAdmin\SqlParser\Tests\TestCase;
7+
8+
class TruncateStatementTest extends TestCase
9+
{
10+
public function testBuilder()
11+
{
12+
$query = 'TRUNCATE TABLE mytable;';
13+
14+
$parser = new Parser($query);
15+
$stmt = $parser->statements[0];
16+
17+
$this->assertEquals($query, $stmt->build());
18+
}
19+
20+
public function testBuilderDbtable()
21+
{
22+
$query = 'TRUNCATE TABLE mydb.mytable;';
23+
24+
$parser = new Parser($query);
25+
$stmt = $parser->statements[0];
26+
27+
$this->assertEquals($query, $stmt->build());
28+
}
29+
30+
public function testBuilderDbtableBackQuotes()
31+
{
32+
$query = 'TRUNCATE TABLE `mydb`.`mytable`;';
33+
34+
$parser = new Parser($query);
35+
$stmt = $parser->statements[0];
36+
37+
$this->assertEquals($query, $stmt->build());
38+
}
39+
40+
}

0 commit comments

Comments
 (0)