コード例 #1
0
 /**
  * @covers Expression::setGroupBy
  * @covers Expression::addGroupBy
  * @covers Expression::clearGroupBy
  * @covers Expression::hasGroupBy
  * @covers Expression::getGroupBy
  */
 public function testGroupBy()
 {
     $this->assertFalse($this->object->hasGroupBy(), 'GroupBy deveria ser vazio');
     $this->assertEquals($this->object, $this->object->setGroupby(array('id')), 'Não retornou o objeto');
     $this->assertEquals($this->object, $this->object->addGroupby('label'), 'Não retornou o objeto');
     $this->assertTrue($this->object->hasGroupBy(), 'GroupBy não deveria ser vazio');
     $this->assertEquals(array('id', 'label'), $this->object->getGroupBy(), 'Retorno inválido');
     $this->assertEquals($this->object, $this->object->clearGroupBy(), 'Não retornou o objeto');
     $this->assertFalse($this->object->hasGroupBy(), 'GroupBy deveria ser vazio novamente');
     $this->object->addGroupBy(1);
     $this->assertFalse($this->object->hasGroupBy(), 'GroupBy deveria continuar vazio');
     $this->object->addGroupBy('teste');
     $this->assertEquals(array('teste'), $this->object->getGroupBy());
     $this->object->setGroupBy('teste2');
     $this->assertEquals(array('teste2'), $this->object->getGroupBy());
 }