summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Components/Array2dTest.php9
-rw-r--r--tests/Components/IntoKeywordTest.php12
-rw-r--r--tests/Components/RenameOperationTest.php18
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');
+ }
+}