コード例 #1
0
 /**
  * @test
  */
 public function itShouldGetIntersectSelects()
 {
     $this->assertEquals(array(), $this->query->getUnions());
     $select1 = new Select('user');
     $select2 = new Select('user_email');
     $this->query->add($select1);
     $this->query->add($select2);
     $this->assertEquals(array($select1, $select2), $this->query->getUnions());
 }
コード例 #2
0
    /**
     * @test
     */
    public function itShouldWriteIntersects()
    {
        $union = new UnionAll();
        $union->add(new Select('user'));
        $union->add(new Select('user_email'));
        $expected = <<<SQL
SELECT user.* FROM user
UNION ALL
SELECT user_email.* FROM user_email
SQL;
        $this->assertEquals($expected, $this->unionAllWriter->write($union));
    }