1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace PhpMyAdmin\SqlParser\Tests\Components; |
6
|
|
|
|
7
|
|
|
use PhpMyAdmin\SqlParser\Components\IntoKeyword; |
8
|
|
|
use PhpMyAdmin\SqlParser\Parser; |
9
|
|
|
use PhpMyAdmin\SqlParser\Tests\TestCase; |
10
|
|
|
|
11
|
|
|
class IntoKeywordTest extends TestCase |
12
|
|
|
{ |
13
|
|
|
public function testParse() |
14
|
|
|
{ |
15
|
|
|
$component = IntoKeyword::parse(new Parser(), $this->getTokensList('OUTFILE "/tmp/outfile.txt"')); |
16
|
|
|
$this->assertEquals($component->type, 'OUTFILE'); |
17
|
|
|
$this->assertEquals($component->dest, '/tmp/outfile.txt'); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public function testBuild() |
21
|
|
|
{ |
22
|
|
|
$component = IntoKeyword::parse(new Parser(), $this->getTokensList('tbl(`col1`, `col2`)')); |
23
|
|
|
$this->assertEquals('tbl(`col1`, `col2`)', IntoKeyword::build($component)); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function testBuildValues() |
27
|
|
|
{ |
28
|
|
|
$component = IntoKeyword::parse(new Parser(), $this->getTokensList('@a1, @a2, @a3')); |
29
|
|
|
$this->assertEquals('@a1, @a2, @a3', IntoKeyword::build($component)); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testBuildOutfile() |
33
|
|
|
{ |
34
|
|
|
$component = IntoKeyword::parse(new Parser(), $this->getTokensList('OUTFILE "/tmp/outfile.txt"')); |
35
|
|
|
$this->assertEquals('OUTFILE "/tmp/outfile.txt"', IntoKeyword::build($component)); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function testParseErr1() |
39
|
|
|
{ |
40
|
|
|
$component = IntoKeyword::parse(new Parser(), $this->getTokensList('OUTFILE;')); |
41
|
|
|
$this->assertEquals($component->type, 'OUTFILE'); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|