示例#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]);
 }
示例#2
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);
 }
示例#3
0
 public function testEntityRecuperadaPeloDataMapperEMarcadaComoVelha()
 {
     $entity = new CoreExt_EntityStub(array('nome' => 'fooBar'));
     $entity->markOld();
     $mapper = $this->getCleanMock('CoreExt_EntityDataMapperStub');
     $mapper->expects($this->once())->method('find')->with(1)->will($this->returnValue($entity));
     $this->assertFalse($mapper->find(1)->isNew());
 }