diff options
author | Dan Ungureanu <udan1107@gmail.com> | 2015-08-14 00:16:12 +0300 |
---|---|---|
committer | Dan Ungureanu <udan1107@gmail.com> | 2015-08-14 00:19:48 +0300 |
commit | 09a7047bf51de1d733dd95674f083c1e11c656e1 (patch) | |
tree | 6a9dbc92d7d4390ecae7cf0776dd6cb20fecef06 /tests/Components | |
parent | a36dbf270118af42e09b223957ed0d96f6ac0ed9 (diff) | |
download | sql-parser-09a7047bf51de1d733dd95674f083c1e11c656e1.zip sql-parser-09a7047bf51de1d733dd95674f083c1e11c656e1.tar.gz sql-parser-09a7047bf51de1d733dd95674f083c1e11c656e1.tar.bz2 |
Finished builders for components.
Diffstat (limited to 'tests/Components')
-rw-r--r-- | tests/Components/Array2dTest.php | 9 | ||||
-rw-r--r-- | tests/Components/IntoKeywordTest.php | 12 | ||||
-rw-r--r-- | tests/Components/RenameOperationTest.php | 18 |
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/Components/Array2dTest.php b/tests/Components/Array2dTest.php index 0ceb345..b268d99 100644 --- a/tests/Components/Array2dTest.php +++ b/tests/Components/Array2dTest.php @@ -20,6 +20,15 @@ class Array2dTest extends TestCase ); } + public function testBuild() + { + $arrays = Array2d::parse(new Parser(), $this->getTokensList('(1, 2), (3, 4), (5, 6)')); + $this->assertEquals( + '(1, 2), (3, 4), (5, 6)', + Array2d::build($arrays) + ); + } + public function testParseErr1() { $parser = new Parser(); diff --git a/tests/Components/IntoKeywordTest.php b/tests/Components/IntoKeywordTest.php index ee30f09..dad7077 100644 --- a/tests/Components/IntoKeywordTest.php +++ b/tests/Components/IntoKeywordTest.php @@ -17,6 +17,18 @@ class IntoKeywordTest extends TestCase $this->assertEquals($component->dest, '/tmp/outfile.txt'); } + public function testBuild() + { + $component = IntoKeyword::parse(new Parser(), $this->getTokensList('tbl(col1, col2)')); + $this->assertEquals('tbl(col1, col2)', IntoKeyword::build($component)); + } + + public function testBuildOutfile() + { + $component = IntoKeyword::parse(new Parser(), $this->getTokensList('OUTFILE "/tmp/outfile.txt"')); + $this->assertEquals('OUTFILE "/tmp/outfile.txt"', IntoKeyword::build($component)); + } + public function testParseErr1() { $component = IntoKeyword::parse(new Parser(), $this->getTokensList('OUTFILE;')); diff --git a/tests/Components/RenameOperationTest.php b/tests/Components/RenameOperationTest.php new file mode 100644 index 0000000..b6a215c --- /dev/null +++ b/tests/Components/RenameOperationTest.php @@ -0,0 +1,18 @@ +<?php + +namespace SqlParser\Tests\Components; + +use SqlParser\Parser; +use SqlParser\Components\RenameOperation; + +use SqlParser\Tests\TestCase; + +class RenameOperationTest extends TestCase +{ + + public function testBuild() + { + $component = RenameOperation::parse(new Parser(), $this->getTokensList('a TO b, c TO d')); + $this->assertEquals(RenameOperation::build($component), 'a TO b, c TO d'); + } +} |