diff options
Diffstat (limited to 'tests/Builder/TransactionStatementTest.php')
-rw-r--r-- | tests/Builder/TransactionStatementTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/Builder/TransactionStatementTest.php b/tests/Builder/TransactionStatementTest.php new file mode 100644 index 0000000..b431643 --- /dev/null +++ b/tests/Builder/TransactionStatementTest.php @@ -0,0 +1,30 @@ +<?php + +namespace SqlParser\Tests\Builder; + +use SqlParser\Parser; + +use SqlParser\Tests\TestCase; + +class TransactionStatementTest extends TestCase +{ + + public function testBuilderView() + { + $query = 'START TRANSACTION;' . + 'SELECT @A:=SUM(salary) FROM table1 WHERE type=1;' . + 'UPDATE table2 SET summary=@A WHERE type=1;' . + 'COMMIT;'; + + $parser = new Parser($query); + $stmt = $parser->statements[0]; + + $this->assertEquals( + 'START TRANSACTION;' . + 'SELECT @A:=SUM(salary) FROM table1 WHERE type=1 ;' . + 'UPDATE table2 SET summary = @A WHERE type=1 ;' . + 'COMMIT', + $stmt->build() + ); + } +} |