summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/Components/CaseExpressionTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Components/CaseExpressionTest.php b/tests/Components/CaseExpressionTest.php
index afe5e60..475486f 100644
--- a/tests/Components/CaseExpressionTest.php
+++ b/tests/Components/CaseExpressionTest.php
@@ -83,4 +83,32 @@ class CaseExpressionTest extends TestCase
'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END'
);
}
+
+ public function testParseBuild7()
+ {
+ $caseExprQuery = 'case when 1=1 then "Some" '
+ . 'when 1=2 then "SomeOther" end AS foo';
+ $component = CaseExpression::parse(
+ new Parser(),
+ $this->getTokensList($caseExprQuery)
+ );
+ $this->assertEquals(
+ CaseExpression::build($component),
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`'
+ );
+ }
+
+ public function testParseBuild8()
+ {
+ $caseExprQuery = 'case when 1=1 then "Some" '
+ . 'when 1=2 then "SomeOther" end foo';
+ $component = CaseExpression::parse(
+ new Parser(),
+ $this->getTokensList($caseExprQuery)
+ );
+ $this->assertEquals(
+ CaseExpression::build($component),
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`'
+ );
+ }
}