Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Sep 28, 2023
1 parent 9f885ab commit 4daf4aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 32 deletions.
9 changes: 7 additions & 2 deletions tests/AbstractQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1183,9 +1183,14 @@ public function testBuildWithQueryAlias($alias, $expected)
[$sql, $params] = $qb->build($query);
$expected = DbHelper::replaceQuotes($expected, $db->getDriverName());
$expectedSql = DbHelper::replaceQuotes(
<<<SQL
WITH $expected AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
$db->getDriverName(),
);
$this->assertSame($expected, $sql);
$this->assertSame($expectedSql, $sql);
$this->assertSame([], $params);
}
Expand Down
35 changes: 5 additions & 30 deletions tests/Provider/QueryBuilderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1235,36 +1235,11 @@ public static function upsert(): array
public static function cteAliases(): array
{
return [
'simple' => [
'a',
<<<SQL
WITH [[a]] AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
],
'with one column' => [
'a(b)',
<<<SQL
WITH [[a]]([[b]]) AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
],
'with columns' => [
'a(b,c,d)',
<<<SQL
WITH [[a]]([[b]], [[c]], [[d]]) AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
],
'with extra space' => [
'a(b,c,d) ',
<<<SQL
WITH a(b,c,d) AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
],
'expression' => [
new Expression('a(b,c,d)'),
<<<SQL
WITH a(b,c,d) AS (SELECT * FROM [[t]]) SELECT * FROM [[t]]
SQL,
],
'simple' => ['a', '[[a]]'],
'with one column' => ['a(b)', '[[a]]([[b]])'],
'with columns' => ['a(b,c,d)', '[[a]]([[b]], [[c]], [[d]])'],
'with extra space' => ['a(b,c,d) ', 'a(b,c,d) '],
'expression' => [new Expression('a(b,c,d)'), 'a(b,c,d)'],
];
}
}

0 comments on commit 4daf4aa

Please sign in to comment.