+ Add vendor of sqlparser.

This commit is contained in:
zhujinyong
2022-08-16 15:02:27 +08:00
parent b6dcbaa519
commit c8f3aec35b
979 changed files with 321906 additions and 0 deletions
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Tests\Components;
use PhpMyAdmin\SqlParser\Components\ExpressionArray;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Tests\TestCase;
class ExpressionArrayTest extends TestCase
{
public function testParse(): void
{
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr)'),
['breakOnParentheses' => true]
);
$this->assertEquals([], $component);
}
public function testParse2(): void
{
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr) +'),
['parenthesesDelimited' => true]
);
$this->assertCount(1, $component);
$this->assertEquals('(expr)', $component[0]->expr);
}
public function testParseWithCommentsNoOptions(): void
{
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr) -- comment ?')
);
$this->assertCount(1, $component);
$this->assertEquals('(expr)', $component[0]->expr);
}
public function testParseWithCommentsAndOptions(): void
{
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr -- comment ?)'),
['parenthesesDelimited' => true]
);
$this->assertCount(1, $component);
$this->assertEquals('(expr', $component[0]->expr);
}
}