summaryrefslogtreecommitdiffstats
path: root/tests/Components/ReferenceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Components/ReferenceTest.php')
-rw-r--r--tests/Components/ReferenceTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/Components/ReferenceTest.php b/tests/Components/ReferenceTest.php
new file mode 100644
index 0000000..f223fb8
--- /dev/null
+++ b/tests/Components/ReferenceTest.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace SqlParser\Tests\Components;
+
+use SqlParser\Parser;
+use SqlParser\Components\Reference;
+
+use SqlParser\Tests\TestCase;
+
+class ReferenceTest extends TestCase
+{
+
+ public function testParse()
+ {
+ $component = Reference::parse(new Parser(), $this->getTokensList('tbl (id)'));
+ $this->assertEquals('tbl', $component->table);
+ $this->assertEquals(array('id'), $component->columns);
+ }
+
+ public function testBuild()
+ {
+ $component = new Reference('tbl', array('id'));
+ $this->assertEquals('`tbl` (`id`)', Reference::build($component));
+ }
+}