示例#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 Union();
        $union->add(new Select('user'));
        $union->add(new Select('user_email'));
        $expected = <<<SQL
SELECT user.* FROM user
UNION
SELECT user_email.* FROM user_email
SQL;
        $this->assertEquals($expected, $this->unionWriter->write($union));
    }