Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for CALL and TRUNCATE statements
Signed-off-by: William Desportes <williamdes@wdes.fr>
- Loading branch information
1 parent
a580bbe
commit a92eaff
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace PhpMyAdmin\SqlParser\Tests\Builder; | ||
|
||
use PhpMyAdmin\SqlParser\Parser; | ||
use PhpMyAdmin\SqlParser\Tests\TestCase; | ||
|
||
class CallStatementTest extends TestCase | ||
{ | ||
public function testBuilder() | ||
{ | ||
$query = 'CALL foo()'; | ||
|
||
$parser = new Parser($query); | ||
$stmt = $parser->statements[0]; | ||
|
||
$this->assertEquals($query, $stmt->build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace PhpMyAdmin\SqlParser\Tests\Builder; | ||
|
||
use PhpMyAdmin\SqlParser\Parser; | ||
use PhpMyAdmin\SqlParser\Tests\TestCase; | ||
|
||
class TruncateStatementTest extends TestCase | ||
{ | ||
public function testBuilder() | ||
{ | ||
$query = 'TRUNCATE TABLE mytable;'; | ||
|
||
$parser = new Parser($query); | ||
$stmt = $parser->statements[0]; | ||
|
||
$this->assertEquals($query, $stmt->build()); | ||
} | ||
|
||
public function testBuilderDbtable() | ||
{ | ||
$query = 'TRUNCATE TABLE mydb.mytable;'; | ||
|
||
$parser = new Parser($query); | ||
$stmt = $parser->statements[0]; | ||
|
||
$this->assertEquals($query, $stmt->build()); | ||
} | ||
|
||
public function testBuilderDbtableBackQuotes() | ||
{ | ||
$query = 'TRUNCATE TABLE `mydb`.`mytable`;'; | ||
|
||
$parser = new Parser($query); | ||
$stmt = $parser->statements[0]; | ||
|
||
$this->assertEquals($query, $stmt->build()); | ||
} | ||
|
||
} |