public function testAtualizaRegistroComChaveComposta() { $this->_db->expects($this->once())->method('Consulta')->will($this->returnValue(TRUE)); $entity = new CoreExt_EntityCompoundStub(); $entity->pessoa = 1; $entity->curso = 1; $entity->confirmado = TRUE; $mapper = new CoreExt_EntityCompoundDataMapperStub($this->_db); $this->assertTrue($mapper->save($entity)); }
public function testApagaRegistroComChaveComposta() { $mapper = new CoreExt_EntityCompoundDataMapperStub($this->getDbAdapter()); $entity = new CoreExt_EntityCompoundStub(array('pessoa' => 1, 'curso' => 2)); $mapper->delete($entity); $this->assertTablesEqual($this->createXMLDataSet($this->getFixture('matricula-depois-removido.xml'))->getTable('matricula'), $this->getConnection()->createDataSet()->getTable('matricula')); // Apaga usando array com os valores da chave $mapper->delete(array('pessoa' => 1, 'curso' => 1)); $this->assertEquals(0, $this->getConnection()->createDataSet()->getTable('matricula')->getRowCount()); }