public function testAtualizaRegistroComChaveComposta()
 {
     $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter());
     $entity = new CoreExt_EntityCompoundStub(array('pessoa' => 1, 'curso' => 2, 'confirmado' => TRUE));
     // Marca como se tivesse sido carregado, para forçar CoreExt_DataMapper
     // a usar o INSERT.
     $entity->markOld();
     $mapper->save($entity);
     $this->assertTablesEqual($this->createXMLDataSet($this->getFixture('matricula-depois-atualizado.xml'))->getTable('matricula'), $this->getConnection()->createDataSet()->getTable('matricula'));
 }
Ejemplo n.º 2
0
 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);
 }