More having tests #475

Merged
merged 1 commit into from Mar 3, 2013
View
10 tests/Database/DatabaseQueryBuilderTest.php
@@ -192,8 +192,16 @@ public function testOrderBys()
public function testHavings()
{
$builder = $this->getBuilder();
+ $builder->select('*')->from('users')->having('email', '>', 1);
+ $this->assertEquals('select * from "users" having "email" > ?', $builder->toSql());
+
+ $builder = $this->getBuilder();
$builder->select('*')->from('users')->groupBy('email')->having('email', '>', 1);
$this->assertEquals('select * from "users" group by "email" having "email" > ?', $builder->toSql());
+
+ $builder = $this->getBuilder();
+ $builder->select('email as foo_email')->from('users')->having('foo_email', '>', 1);
+ $this->assertEquals('select "email" as "foo_email" from "users" having "foo_email" > ?', $builder->toSql());
}
@@ -630,4 +638,4 @@ protected function getSqlServerBuilder()
return new Builder(m::mock('Illuminate\Database\ConnectionInterface'), $grammar, $processor);
}
-}
+}