summaryrefslogtreecommitdiffstats
path: root/tests/Components/ConditionTest.php
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-07-10 01:45:45 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-07-10 03:47:19 +0300
commit527842708bf44fe2bb4d17a97203cec01b860960 (patch)
tree9eb52c23199199b721b5412e1c16d9129d624e52 /tests/Components/ConditionTest.php
parent7c925b68763e86be121664575632c9261d380821 (diff)
downloadsql-parser-527842708bf44fe2bb4d17a97203cec01b860960.zip
sql-parser-527842708bf44fe2bb4d17a97203cec01b860960.tar.gz
sql-parser-527842708bf44fe2bb4d17a97203cec01b860960.tar.bz2
Mass renaming. Using 'component' instead of 'fragment'.
Diffstat (limited to 'tests/Components/ConditionTest.php')
-rw-r--r--tests/Components/ConditionTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/Components/ConditionTest.php b/tests/Components/ConditionTest.php
new file mode 100644
index 0000000..b3279fe
--- /dev/null
+++ b/tests/Components/ConditionTest.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace SqlParser\Tests\Components;
+
+use SqlParser\Parser;
+use SqlParser\Components\Condition;
+
+use SqlParser\Tests\TestCase;
+
+class ConditionTest extends TestCase
+{
+
+ public function testParse()
+ {
+ $component = Condition::parse(new Parser(), $this->getTokensList('/* id = */ id = 10'));
+ $this->assertEquals($component[0]->expr, 'id = 10');
+ }
+
+ public function testParseBetween()
+ {
+ $component = Condition::parse(new Parser(), $this->getTokensList('(id BETWEEN 10 AND 20) OR (id BETWEEN 30 AND 40)'));
+ $this->assertEquals($component[0]->expr, '(id BETWEEN 10 AND 20)');
+ $this->assertEquals($component[1]->expr, 'OR');
+ $this->assertEquals($component[2]->expr, '(id BETWEEN 30 AND 40)');
+ }
+}