From e9f72290d90a753ef505339bc330dec149252286 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Mon, 20 May 2019 11:50:34 +0200 Subject: [PATCH] Test illustrate multiple unions --- tests/SelectTest.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/SelectTest.php b/tests/SelectTest.php index d773b95..5541745 100644 --- a/tests/SelectTest.php +++ b/tests/SelectTest.php @@ -589,6 +589,46 @@ public function testUnion() $this->assertSameSql($expect, $actual); } + public function testMultipleUnion() + { + $this->query->columns('c1') + ->from('t1') + ->union() + ->columns('c2') + ->from('t2') + ->union() + ->columns('c3') + ->from('t3') + ->union() + ->columns('c4') + ->from('t4'); + + $expect = ' + SELECT + c1 + FROM + t1 + UNION + SELECT + c2 + FROM + t2 + UNION + SELECT + c3 + FROM + t3 + UNION + SELECT + c4 + FROM + t4 + '; + + $actual = $this->query->getStatement(); + $this->assertSameSql($expect, $actual); + } + public function testUnionAll() { $this->query->columns('c1')