summaryrefslogtreecommitdiffstats
path: root/tests/Components/ConditionTest.php
diff options
context:
space:
mode:
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)');
+ }
+}