Пример #1
0
 public function testMapeiaAtributoAtravesDoMapaQuandoNaoExisteAtributoCorrespondente()
 {
     $common = array('nome' => 'Adolf Lutz');
     $options = $returnedOptions = $common;
     $options['estadoCivil'] = 'solteiro';
     $returnedOptions['estado_civil'] = 'solteiro';
     $expected = new CoreExt_EntityStub($options);
     $expected->markOld();
     $this->_db->expects($this->any())->method('ProximoRegistro')->will($this->onConsecutiveCalls(TRUE, FALSE));
     $this->_db->expects($this->any())->method('Tupla')->will($this->onConsecutiveCalls($returnedOptions));
     $mapper = new CoreExt_EntityDataMapperStub($this->_db);
     $found = $mapper->findAll();
     $this->assertEquals($expected, $found[0]);
 }
Пример #2
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]);
 }