コード例 #1
0
 public function testShouldProduceSelectStatementWithHaving()
 {
     $table = "test";
     $sql = Query::getInstance()->select(Projections::count("id"))->from($table)->group(Group::groupBy("id"))->having(Projections::gt(Projections::count("id"), "?"))->build();
     $expectedSql = "SELECT COUNT(id) FROM {$table} GROUP BY id HAVING ( COUNT(id) > ?)";
     $this->assertThat($sql, $this->equalTo($expectedSql));
 }