Example #1
0
 public function testRecuperaRegistroComParametrosWhere()
 {
     $mapper = new CoreExt_EntityDataMapperStub($this->getDbAdapter());
     $found = $mapper->findAll(array(), array('estadoCivil' => 'solteiro'));
     $expected = new CoreExt_EntityStub(array('id' => 1, 'nome' => 'Arnaldo Antunes', 'estadoCivil' => 'solteiro', 'doador' => TRUE));
     // Marca como se tivesse sido carregado, para garantir a comparação
     $expected->markOld();
     $this->assertEquals($expected, $found[0]);
 }
 public function testRecuperaRegistroUnico()
 {
     $expectedOptions = array('id' => 1, 'nome' => 'Henry Nobel', 'estadoCivil' => 'solteiro');
     $expected = new CoreExt_EntityStub($expectedOptions);
     $expected->markOld();
     $this->_db->expects($this->any())->method('ProximoRegistro')->will($this->returnValue(TRUE, FALSE));
     $this->_db->expects($this->any())->method('Tupla')->will($this->returnValue($expectedOptions));
     $mapper = new CoreExt_EntityDataMapperStub($this->_db);
     $found = $mapper->find(1);
     $this->assertEquals($expected, $found);
 }
Example #3
0
 /**
  * @expectedException CoreExt_Exception_InvalidArgumentException
  */
 public function testInstanciaDeClassNaoEspecificaLancaExcecaoQuandoInstanciaPassadaNaoTemAMesmaAssinaturaDoNomeDeClasseInformado()
 {
     CoreExt_EntityStub::addClassToStorage('fooBar', new stdClass());
 }