Skip to content

Commit

Permalink
Adding more test cases for withStatements
Browse files Browse the repository at this point in the history
  • Loading branch information
iifawzi committed Dec 5, 2021
1 parent f56b027 commit a615674
Show file tree
Hide file tree
Showing 20 changed files with 12,595 additions and 1,281 deletions.
2 changes: 1 addition & 1 deletion src/Statements/CreateStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class CreateStatement extends Statement
/**
* If `CREATE TABLE WITH`.
* If `CREATE TABLE AS WITH`.
* If `CREATE VIEW AS ` WITH`.
* If `CREATE VIEW AS WITH`.
*
* Used by `CREATE TABLE`, `CREATE VIEW`
*
Expand Down
26 changes: 26 additions & 0 deletions tests/Parser/WithStatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,32 @@

class WithStatementTest extends TestCase
{
/**
* @param mixed $test
*
* @dataProvider parseWith
*/
public function testParse($test): void
{
$this->runParserTest($test);
}

public function parseWith(): array
{
return [
['parser/parseWithStatement'],
['parser/parseWithStatement1'],
['parser/parseWithStatement2'],
['parser/parseWithStatement3'],
['parser/parseWithStatementErr'],
['parser/parseWithStatementErr1'],
['parser/parseWithStatementErr2'],
['parser/parseWithStatementErr3'],
['parser/parseWithStatementErr4'],
['parser/parseWithStatementErr5'],
];
}

public function testWith(): void
{
$sql = <<<SQL
Expand Down
1 change: 1 addition & 0 deletions tests/data/parser/parseWithStatement1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE table table_name WITH cte (col1) AS ( SELECT 1 UNION ALL SELECT 2 ) SELECT col1 FROM cte
Loading

0 comments on commit a615674

Please sign in to comment.