/** * @covers Expression::setHaving * @covers Expression::getHaving * @covers Expression::hasHaving * @covers Expression::clearHaving */ public function testHaving() { $this->assertFalse($this->object->hasHaving(), 'Having deveria ser vazio'); $this->assertEquals($this->object, $this->object->setHaving(array('id' => 1)), 'Não retornou o objeto'); $this->assertTrue($this->object->hasHaving(), 'Having não deveria ser vazio'); $this->assertEquals(array(1), $this->object->getHaving()->getParams(), 'Parametro inválido para o having'); $this->object->setHaving(array()); $this->assertFalse($this->object->hasHaving(), 'Having deveria ser vazio novamente'); $where = Where::getInstance(array('id' => 2)); $this->object->setHaving($where); $this->assertEquals($where, $this->object->getHaving()); $this->assertEquals($this->object, $this->object->clearHaving(), 'Não retornou o objeto'); $this->assertFalse($this->object->hasHaving(), 'Having deveria ser vazio novamente'); }