public function testRecuperaRegistroUnico() { $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); $found = $mapper->find(array(1, 1)); $expected = new CoreExt_EntityCompoundStub(array('pessoa' => 1, 'curso' => 1, 'confirmado' => TRUE)); // Marca como se tivesse sido carregado, para garantir a comparação $expected->markOld(); $this->assertEquals($expected, $found); $this->assertFalse($found->isNew()); }
public function testRecuperaRegistroUnicoComChaveCompostaIdentificandoApenasUmaDasChaves() { $expectedOptions = array('pessoa' => 1, 'curso' => 1, 'confirmado' => TRUE); $expected = new CoreExt_EntityCompoundStub($expectedOptions); $expected->markOld(); $this->_db->expects($this->once())->method('ProximoRegistro')->will($this->returnValue(TRUE)); $this->_db->expects($this->any())->method('Tupla')->will($this->returnValue($expectedOptions)); $mapper = new CoreExt_EntityCompoundDataMapperStub($this->_db); $found = $mapper->find(array('pessoa' => 1)); $this->assertEquals($expected, $found); }