From 522e4cc40ff3a35bb3b9da315804246c3750ff35 Mon Sep 17 00:00:00 2001 From: Marcus Dias Date: Tue, 16 Apr 2024 15:40:02 -0300 Subject: [PATCH] tests: rebase dos PRs das issues 420 e 442 para a release 3.7.0 --- tests_sei4/funcional/bootstrap.php | 1 + .../tests/FixtureCenarioBaseTestCase.php | 188 +++++++++++++++++ ...TramiteProcessoAnexadoComDevolucaoTest.php | 184 ++++++++++++++--- .../tests/TramiteProcessoAnexadoTest.php | 131 +++++++++--- ...teProcessoComDevolucaoAnexadoOutroTest.php | 43 ++-- tests_super/funcional/bootstrap.php | 1 + .../tests/FixtureCenarioBaseTestCase.php | 191 ++++++++++++++++++ ...TramiteProcessoAnexadoComDevolucaoTest.php | 184 ++++++++++++++--- .../tests/TramiteProcessoAnexadoTest.php | 131 +++++++++--- ...teProcessoComDevolucaoAnexadoOutroTest.php | 43 ++-- 10 files changed, 959 insertions(+), 138 deletions(-) create mode 100755 tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php create mode 100755 tests_super/funcional/tests/FixtureCenarioBaseTestCase.php diff --git a/tests_sei4/funcional/bootstrap.php b/tests_sei4/funcional/bootstrap.php index 7e81e46e9..2d202ecd5 100755 --- a/tests_sei4/funcional/bootstrap.php +++ b/tests_sei4/funcional/bootstrap.php @@ -39,3 +39,4 @@ require_once __DIR__ . '/src/paginas/PaginaEnvioParcialListar.php'; require_once __DIR__ . '/tests/CenarioBaseTestCase.php'; +require_once __DIR__ . '/tests/FixtureCenarioBaseTestCase.php'; diff --git a/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php new file mode 100755 index 000000000..fc3b6535f --- /dev/null +++ b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php @@ -0,0 +1,188 @@ + $dadosProcesso['DESCRICAO'], + 'Interessados' => $dadosProcesso['INTERESSADOS'], + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->carregar($parametros); + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => $parametros['Interessados'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + $dadosProcesso['PROTOCOLO'] = $protocoloGerado; + + return $objProtocoloDTO; + } + + protected function cadastrarDocumentoInternoFixture($dadosDocumentoInterno, $idProtocolo) + { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdProcedimento' => $idProtocolo, + 'Descricao' => $dadosDocumentoInterno['DESCRICAO'], + ]); + + //Adicionar assinatura ao documento + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + + } + + protected function cadastrarDocumentoExternoFixture($dadosDocumentoExterno, $idProtocolo) + { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdProcedimento' => $idProtocolo, + 'Descricao' => $dadosDocumentoExterno['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + + //Adicionar anexo ao documento + $objAnexoFixture = new AnexoFixture(); + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename($dadosDocumentoExterno['ARQUIVO']), + ]); + + } + + protected function anexarProcessoFixture($protocoloPrincipalId, $protocoloProcessoAnexadoId) + { + // Realizar a anexação de processos + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => $protocoloPrincipalId, + 'IdDocumento' => $protocoloProcessoAnexadoId, + ]); + } + + protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) + { + $orgaosDiferentes = $remetente['URL'] != $destinatario['URL']; + + $buscar = false; + // 1 - Cadastrar novo processo de teste + if (isset($processoTeste['PROTOCOLO'])) { + $strProtocoloTeste = $processoTeste['PROTOCOLO']; + + $parametros = [ + 'ProtocoloFormatado' => $strProtocoloTeste, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->buscar($parametros)[0]; + + } else { + $objProtocoloDTO = $this->cadastrarProcessoFixture($processoTeste); + $strProtocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + $processoTeste['PROTOCOLO'] = $strProtocoloTeste; + } + + // 2 - Incluir Documentos no Processo + $documentosTeste = array_key_exists('TIPO', $documentosTeste) ? array($documentosTeste) : $documentosTeste; + foreach ($documentosTeste as $doc) { + if ($doc['TIPO'] == 'G') { + // cadastra e assina documento interno + $this->cadastrarDocumentoInternoFixture($doc,$objProtocoloDTO->getDblIdProtocolo()); + } else if ($doc['TIPO'] == 'R') { + $this->cadastrarDocumentoExternoFixture($doc, $objProtocoloDTO->getDblIdProtocolo()); + } + } + + // 3 - Acessar sistema do REMETENTE do processo + $this->acessarSistema($remetente['URL'], $remetente['SIGLA_UNIDADE'], $remetente['LOGIN'], $remetente['SENHA']); + + // 4 - Abrir processo + $this->abrirProcesso($strProtocoloTeste); + + // 5 - Trâmitar Externamento processo para órgão/unidade destinatária + $paginaTramitar = $this->paginaTramitar; + $this->tramitarProcessoExternamente($strProtocoloTeste, $destinatario['REP_ESTRUTURAS'], $destinatario['NOME_UNIDADE'], $destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); + + if ($validarTramite) { + // 6 - Verificar se situação atual do processo está como bloqueado + $this->waitUntil(function ($testCase) use (&$orgaosDiferentes) { + sleep(5); + $this->atualizarTramitesPEN(); + $testCase->refresh(); + $paginaProcesso = new PaginaProcesso($testCase); + $testCase->assertStringNotContainsString(utf8_encode("Processo em trâmite externo para "), $paginaProcesso->informacao()); + $testCase->assertFalse($paginaProcesso->processoAberto()); + $testCase->assertEquals($orgaosDiferentes, $paginaProcesso->processoBloqueado()); + return true; + }, PEN_WAIT_TIMEOUT); + + // 7 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) + $unidade = mb_convert_encoding($destinatario['NOME_UNIDADE'], "ISO-8859-1"); + $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", $strProtocoloTeste, $unidade); + $this->validarRecibosTramite($mensagemRecibo, true, true); + + // 8 - Validar histórico de trâmite do processo + $this->validarHistoricoTramite(self::$nomeUnidadeDestinatario, true, true); + + // 9 - Verificar se processo está na lista de Processos Tramitados Externamente + $deveExistir = $remetente['URL'] != $destinatario['URL']; + $this->validarProcessosTramitados($strProtocoloTeste, $deveExistir); + } + } + + public function realizarTramiteExternoComValidacaoNoRemetenteFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario) + { + $this->realizarTramiteExternoFixture($processoTeste, $documentosTeste, $remetente, $destinatario, true); + } + + public function realizarTramiteExternoSemvalidacaoNoRemetenteFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario) + { + $this->realizarTramiteExternoFixture($processoTeste, $documentosTeste, $remetente, $destinatario, false); + } + +} diff --git a/tests_sei4/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php b/tests_sei4/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php index e9604e732..9d0fcd1e1 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php @@ -1,5 +1,7 @@ gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste1 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); // Definição de dados de teste do processo a ser anexado self::$processoTesteAnexado = $this->gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Cadastrar novo processo de teste anexado e incluir documentos relacionados - self::$protocoloTesteAnexado = $this->cadastrarProcesso(self::$processoTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); + self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + + $parametros = [ + [ + 'Descricao' => self::$processoTestePrincipal['DESCRICAO'], + 'Interessados' => self::$processoTestePrincipal['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste1, self::$documentoTeste2], + ], + [ + 'Descricao' => self::$processoTesteAnexado['DESCRICAO'], + 'Interessados' => self::$processoTesteAnexado['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste3, self::$documentoTeste4], + ] + ]; + + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocolosDTO = $objProtocoloFixture->carregarVariados($parametros); // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $i = 0; + foreach($objProtocolosDTO as $objProtocoloDTO) { + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => self::$processoTestePrincipal['INTERESSADOS'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + // Incluir e assinar documentos relacionados + foreach($parametros[$i]['Documentos'] as $documento) { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProcedimentoDTO->getDblIdProcedimento(), + 'Descricao' => $documento['DESCRICAO'], + ]); + // Armazenar nome que o arquivo receberá no org destinatário + $docs[$i][] = str_pad($objDocumentoDTO->getDblIdDocumento(), 6, 0, STR_PAD_LEFT).'.html'; + + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + } + $protocolo[$i]['formatado'] = $objProtocoloDTO->getStrProtocoloFormatado(); + $protocolo[$i]['id'] = $objProtocoloDTO->getDblIdProtocolo(); + $i++; + } + + // Preencher variaveis que serão usadas posteriormente nos testes + self::$documentoTeste1['ARQUIVO'] = $docs[0][0]; + self::$documentoTeste2['ARQUIVO'] = $docs[0][1]; + self::$documentoTeste3['ARQUIVO'] = $docs[1][0]; + self::$documentoTeste4['ARQUIVO'] = $docs[1][1]; + self::$protocoloTestePrincipal = $protocolo[0]['formatado']; + self::$protocoloTestePrincipalId = $protocolo[0]['id']; + self::$protocoloTesteAnexado = $protocolo[1]['formatado']; + self::$protocoloTesteAnexadoId = $protocolo[1]['id']; // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); - - $this->cadastrarDocumentoExterno(self::$documentoTeste2); + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => self::$protocoloTestePrincipalId, + 'IdDocumento' => self::$protocoloTesteAnexadoId, + ]); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -71,9 +154,9 @@ public function test_tramitar_processo_anexado_da_origem() self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false ); + } - /** * Teste de verificação do correto envio do processo anexado no sistema remetente * @@ -127,7 +210,6 @@ public function test_verificar_destino_processo_anexado() $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$destinatario['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); - $strTipoProcesso = utf8_encode("Tipo de processo no órgão de origem: "); $strTipoProcesso .= self::$processoTestePrincipal['TIPO_PROCESSO']; $strObservacoes = $orgaosDiferentes ? $strTipoProcesso : null; @@ -144,7 +226,7 @@ public function test_verificar_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(3, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->paginaProcesso->selecionarDocumento(self::$protocoloTesteAnexado); $this->assertTrue($this->paginaDocumento->ehProcessoAnexado()); @@ -157,7 +239,6 @@ public function test_verificar_destino_processo_anexado() $this->validarDadosDocumento($listaDocumentosProcessoAnexado[1], self::$documentoTeste4, self::$destinatario); } - /** * Teste de trâmite externo de processo realizando a devolução para a mesma unidade de origem * @@ -172,18 +253,58 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); - + // Definição de dados de teste do processo principal self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente,'arquivo_pequeno_A.pdf'); + + // Selecionar banco do org2 para fazer inserção dos documentos + putenv("DATABASE_HOST=org2-database"); + + // Busca ID que Protocolo principal recebeu no org2 + $parametros = [ + 'ProtocoloFormatado' => self::$protocoloTestePrincipal, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->buscar($parametros)[0]; + + //Incluir novos documentos relacionados + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProtocoloDTO->getDblIdProtocolo(), + 'Descricao' => self::$documentoTeste5['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + //Adicionar anexo ao documento + $objAnexoFixture = new AnexoFixture(); + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename(self::$documentoTeste5['ARQUIVO']), + ]); + + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProtocoloDTO->getDblIdProtocolo(), + 'Descricao' => self::$documentoTeste6['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename(self::$documentoTeste6['ARQUIVO']), + ]); + + //Fim das operações no BD do org2 + putenv("DATABASE_HOST=org1-database"); // Acessar sistema do this->REMETENTE do processo $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Incluir novos documentos relacionados $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); - $this->cadastrarDocumentoExterno(self::$documentoTeste6); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -209,6 +330,7 @@ public function test_devolucao_processo_para_origem() public function test_verificar_devolucao_origem_processo_anexado() { $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); @@ -243,10 +365,8 @@ public function test_verificar_devolucao_origem_processo_anexado() public function test_verificar_devolucao_destino_processo_anexado() { $strProtocoloTeste = self::$protocoloTestePrincipal; - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - - $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$destinatario['SENHA']); + $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$remetente['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); $this->validarDadosProcesso( @@ -262,7 +382,7 @@ public function test_verificar_devolucao_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(5, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[3], self::$documentoTeste5, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[4], self::$documentoTeste6, self::$destinatario); diff --git a/tests_sei4/funcional/tests/TramiteProcessoAnexadoTest.php b/tests_sei4/funcional/tests/TramiteProcessoAnexadoTest.php index 5ebaa1cfc..3e72143cf 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoAnexadoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoAnexadoTest.php @@ -1,5 +1,7 @@ gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste1 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); // Definição de dados de teste do processo a ser anexado self::$processoTesteAnexado = $this->gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Cadastrar novo processo de teste anexado e incluir documentos relacionados - self::$protocoloTesteAnexado = $this->cadastrarProcesso(self::$processoTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); - + self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + + $parametros = [ + [ + 'Descricao' => self::$processoTestePrincipal['DESCRICAO'], + 'Interessados' => self::$processoTestePrincipal['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste1, self::$documentoTeste2], + ], + [ + 'Descricao' => self::$processoTesteAnexado['DESCRICAO'], + 'Interessados' => self::$processoTesteAnexado['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste3, self::$documentoTeste4], + ] + ]; + + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocolosDTO = $objProtocoloFixture->carregarVariados($parametros); + // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $i = 0; + foreach($objProtocolosDTO as $objProtocoloDTO) { + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => self::$processoTestePrincipal['INTERESSADOS'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + // Incluir e assinar documentos relacionados + foreach($parametros[$i]['Documentos'] as $documento) { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProcedimentoDTO->getDblIdProcedimento(), + 'Descricao' => $documento['DESCRICAO'], + ]); + + // Armazenar nome que o arquivo receberá no org destinatário + $docs[$i][] = str_pad($objDocumentoDTO->getDblIdDocumento(), 6, 0, STR_PAD_LEFT).'.html'; + + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + } + $protocolo[$i]['formatado'] = $objProtocoloDTO->getStrProtocoloFormatado(); + $protocolo[$i]['id'] = $objProtocoloDTO->getDblIdProtocolo(); + $i++; + } + + // Preencher variaveis que serão usadas posteriormente nos testes + self::$documentoTeste1['ARQUIVO'] = $docs[0][0]; + self::$documentoTeste2['ARQUIVO'] = $docs[0][1]; + self::$documentoTeste3['ARQUIVO'] = $docs[1][0]; + self::$documentoTeste4['ARQUIVO'] = $docs[1][1]; + self::$protocoloTestePrincipal = $protocolo[0]['formatado']; + self::$protocoloTestePrincipalId = $protocolo[0]['id']; + self::$protocoloTesteAnexado = $protocolo[1]['formatado']; + self::$protocoloTesteAnexadoId = $protocolo[1]['id']; // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); - - $this->cadastrarDocumentoExterno(self::$documentoTeste2); - + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => self::$protocoloTestePrincipalId, + 'IdDocumento' => self::$protocoloTesteAnexadoId, + ]); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -71,9 +154,9 @@ public function test_tramitar_processo_anexado_da_origem() self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false ); + } - - + /** * Teste de verificação do correto envio do processo anexado no sistema remetente * @@ -109,7 +192,7 @@ public function test_verificar_origem_processo_anexado() $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); } - + /** * Teste de verificação do correto recebimento do processo anexado no destinatário * @@ -143,7 +226,7 @@ public function test_verificar_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(3, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->paginaProcesso->selecionarDocumento(self::$protocoloTesteAnexado); $this->assertTrue($this->paginaDocumento->ehProcessoAnexado()); diff --git a/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php b/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php index 4774100f4..a4d714d8e 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php @@ -1,5 +1,7 @@ gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1, self::$documentoTeste2); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); self::$protocoloTesteAnexado = self::$processoTesteAnexado["PROTOCOLO"]; } @@ -84,15 +87,18 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + // Selecionar banco do org2 para fazer inserção dos documentos + putenv("DATABASE_HOST=org2-database"); self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Incluir novos documentos relacionados no processo anexado - $this->abrirProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); + // Busca ID que Protocolo principal recebeu no org2 + $parametros = [ + 'ProtocoloFormatado' => self::$protocoloTesteAnexado, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloAnexadoDTO = $objProtocoloFixture->buscar($parametros)[0]; + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloAnexadoDTO->getDblIdProtocolo()); // Gerar dados de testes para representar o processo principal self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); @@ -100,14 +106,25 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); // Cadastra processo principal, seus documentos e anexa processo recebido anteriormente - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoInterno(self::$documentoTeste4); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $objProtocoloPrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = $objProtocoloPrincipalDTO->getStrProtocoloFormatado(); + + // Cadastra e assina + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste4,$objProtocoloPrincipalDTO->getDblIdProtocolo()); - $this->anexarProcesso(self::$protocoloTesteAnexado); + // $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); + $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloPrincipalDTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + // Abre processo principal para tramitar + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_super/funcional/bootstrap.php b/tests_super/funcional/bootstrap.php index 449af590c..9bb6edcd3 100755 --- a/tests_super/funcional/bootstrap.php +++ b/tests_super/funcional/bootstrap.php @@ -39,3 +39,4 @@ require_once __DIR__ . '/src/paginas/PaginaEnvioParcialListar.php'; require_once __DIR__ . '/tests/CenarioBaseTestCase.php'; +require_once __DIR__ . '/tests/FixtureCenarioBaseTestCase.php'; diff --git a/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php new file mode 100755 index 000000000..d0683ba61 --- /dev/null +++ b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php @@ -0,0 +1,191 @@ + $dadosProcesso['DESCRICAO'], + 'Interessados' => $dadosProcesso['INTERESSADOS'], + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->carregar($parametros); + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => $parametros['Interessados'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + $dadosProcesso['PROTOCOLO'] = $protocoloGerado; + + return $objProtocoloDTO; + } + + protected function cadastrarDocumentoInternoFixture($dadosDocumentoInterno, $idProtocolo) + { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdProcedimento' => $idProtocolo, + 'Descricao' => $dadosDocumentoInterno['DESCRICAO'], + ]); + + //Adicionar assinatura ao documento + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + + } + + protected function cadastrarDocumentoExternoFixture($dadosDocumentoExterno, $idProtocolo) + { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $idProtocolo, + 'IdProcedimento' => $idProtocolo, + 'Descricao' => $dadosDocumentoExterno['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + + //Adicionar anexo ao documento + $objAnexoFixture = new AnexoFixture(); + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename($dadosDocumentoExterno['ARQUIVO']), + ]); + + } + + protected function anexarProcessoFixture($protocoloPrincipalId, $protocoloProcessoAnexadoId) + { + // Realizar a anexação de processos + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => $protocoloPrincipalId, + 'IdDocumento' => $protocoloProcessoAnexadoId, + ]); + } + + protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) + { + $orgaosDiferentes = $remetente['URL'] != $destinatario['URL']; + + $buscar = false; + // 1 - Cadastrar novo processo de teste + if (isset($processoTeste['PROTOCOLO'])) { + $strProtocoloTeste = $processoTeste['PROTOCOLO']; + + $parametros = [ + 'ProtocoloFormatado' => $strProtocoloTeste, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->buscar($parametros)[0]; + + } else { + $objProtocoloDTO = $this->cadastrarProcessoFixture($processoTeste); + $strProtocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + $processoTeste['PROTOCOLO'] = $strProtocoloTeste; + } + + // 2 - Incluir Documentos no Processo + $documentosTeste = array_key_exists('TIPO', $documentosTeste) ? array($documentosTeste) : $documentosTeste; + foreach ($documentosTeste as $doc) { + if ($doc['TIPO'] == 'G') { + // cadastra e assina documento interno + $this->cadastrarDocumentoInternoFixture($doc,$objProtocoloDTO->getDblIdProtocolo()); + } else if ($doc['TIPO'] == 'R') { + $this->cadastrarDocumentoExternoFixture($doc, $objProtocoloDTO->getDblIdProtocolo()); + } + } + + // 3 - Acessar sistema do REMETENTE do processo + $this->acessarSistema($remetente['URL'], $remetente['SIGLA_UNIDADE'], $remetente['LOGIN'], $remetente['SENHA']); + + // 4 - Abrir processo + $this->abrirProcesso($strProtocoloTeste); + + // 5 - Trâmitar Externamento processo para órgão/unidade destinatária + $paginaTramitar = $this->paginaTramitar; + $this->tramitarProcessoExternamente($strProtocoloTeste, $destinatario['REP_ESTRUTURAS'], $destinatario['NOME_UNIDADE'], $destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); + + if ($validarTramite) { + // 6 - Verificar se situação atual do processo está como bloqueado + $this->waitUntil(function ($testCase) use (&$orgaosDiferentes) { + sleep(5); + $this->atualizarTramitesPEN(); + $testCase->refresh(); + $paginaProcesso = new PaginaProcesso($testCase); + $testCase->assertStringNotContainsString(utf8_encode("Processo em trâmite externo para "), $paginaProcesso->informacao()); + $testCase->assertFalse($paginaProcesso->processoAberto()); + $testCase->assertEquals($orgaosDiferentes, $paginaProcesso->processoBloqueado()); + return true; + }, PEN_WAIT_TIMEOUT); + + // 7 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) + $unidade = mb_convert_encoding($destinatario['NOME_UNIDADE'], "ISO-8859-1"); + $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", $strProtocoloTeste, $unidade); + $this->validarRecibosTramite($mensagemRecibo, true, true); + + // 8 - Validar histórico de trâmite do processo + $this->validarHistoricoTramite(self::$nomeUnidadeDestinatario, true, true); + + // 9 - Verificar se processo está na lista de Processos Tramitados Externamente + $deveExistir = $remetente['URL'] != $destinatario['URL']; + $this->validarProcessosTramitados($strProtocoloTeste, $deveExistir); + } + } + + public function realizarTramiteExternoComValidacaoNoRemetenteFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario) + { + $this->realizarTramiteExternoFixture($processoTeste, $documentosTeste, $remetente, $destinatario, true); + } + + public function realizarTramiteExternoSemvalidacaoNoRemetenteFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario) + { + $this->realizarTramiteExternoFixture($processoTeste, $documentosTeste, $remetente, $destinatario, false); + } + +} diff --git a/tests_super/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php b/tests_super/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php index e9604e732..9d0fcd1e1 100755 --- a/tests_super/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoAnexadoComDevolucaoTest.php @@ -1,5 +1,7 @@ gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste1 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); // Definição de dados de teste do processo a ser anexado self::$processoTesteAnexado = $this->gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Cadastrar novo processo de teste anexado e incluir documentos relacionados - self::$protocoloTesteAnexado = $this->cadastrarProcesso(self::$processoTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); + self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + + $parametros = [ + [ + 'Descricao' => self::$processoTestePrincipal['DESCRICAO'], + 'Interessados' => self::$processoTestePrincipal['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste1, self::$documentoTeste2], + ], + [ + 'Descricao' => self::$processoTesteAnexado['DESCRICAO'], + 'Interessados' => self::$processoTesteAnexado['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste3, self::$documentoTeste4], + ] + ]; + + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocolosDTO = $objProtocoloFixture->carregarVariados($parametros); // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $i = 0; + foreach($objProtocolosDTO as $objProtocoloDTO) { + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => self::$processoTestePrincipal['INTERESSADOS'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + // Incluir e assinar documentos relacionados + foreach($parametros[$i]['Documentos'] as $documento) { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProcedimentoDTO->getDblIdProcedimento(), + 'Descricao' => $documento['DESCRICAO'], + ]); + // Armazenar nome que o arquivo receberá no org destinatário + $docs[$i][] = str_pad($objDocumentoDTO->getDblIdDocumento(), 6, 0, STR_PAD_LEFT).'.html'; + + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + } + $protocolo[$i]['formatado'] = $objProtocoloDTO->getStrProtocoloFormatado(); + $protocolo[$i]['id'] = $objProtocoloDTO->getDblIdProtocolo(); + $i++; + } + + // Preencher variaveis que serão usadas posteriormente nos testes + self::$documentoTeste1['ARQUIVO'] = $docs[0][0]; + self::$documentoTeste2['ARQUIVO'] = $docs[0][1]; + self::$documentoTeste3['ARQUIVO'] = $docs[1][0]; + self::$documentoTeste4['ARQUIVO'] = $docs[1][1]; + self::$protocoloTestePrincipal = $protocolo[0]['formatado']; + self::$protocoloTestePrincipalId = $protocolo[0]['id']; + self::$protocoloTesteAnexado = $protocolo[1]['formatado']; + self::$protocoloTesteAnexadoId = $protocolo[1]['id']; // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); - - $this->cadastrarDocumentoExterno(self::$documentoTeste2); + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => self::$protocoloTestePrincipalId, + 'IdDocumento' => self::$protocoloTesteAnexadoId, + ]); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -71,9 +154,9 @@ public function test_tramitar_processo_anexado_da_origem() self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false ); + } - /** * Teste de verificação do correto envio do processo anexado no sistema remetente * @@ -127,7 +210,6 @@ public function test_verificar_destino_processo_anexado() $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$destinatario['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); - $strTipoProcesso = utf8_encode("Tipo de processo no órgão de origem: "); $strTipoProcesso .= self::$processoTestePrincipal['TIPO_PROCESSO']; $strObservacoes = $orgaosDiferentes ? $strTipoProcesso : null; @@ -144,7 +226,7 @@ public function test_verificar_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(3, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->paginaProcesso->selecionarDocumento(self::$protocoloTesteAnexado); $this->assertTrue($this->paginaDocumento->ehProcessoAnexado()); @@ -157,7 +239,6 @@ public function test_verificar_destino_processo_anexado() $this->validarDadosDocumento($listaDocumentosProcessoAnexado[1], self::$documentoTeste4, self::$destinatario); } - /** * Teste de trâmite externo de processo realizando a devolução para a mesma unidade de origem * @@ -172,18 +253,58 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); - + // Definição de dados de teste do processo principal self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente,'arquivo_pequeno_A.pdf'); + + // Selecionar banco do org2 para fazer inserção dos documentos + putenv("DATABASE_HOST=org2-database"); + + // Busca ID que Protocolo principal recebeu no org2 + $parametros = [ + 'ProtocoloFormatado' => self::$protocoloTestePrincipal, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->buscar($parametros)[0]; + + //Incluir novos documentos relacionados + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProtocoloDTO->getDblIdProtocolo(), + 'Descricao' => self::$documentoTeste5['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + //Adicionar anexo ao documento + $objAnexoFixture = new AnexoFixture(); + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename(self::$documentoTeste5['ARQUIVO']), + ]); + + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProtocoloDTO->getDblIdProtocolo(), + 'Descricao' => self::$documentoTeste6['DESCRICAO'], + 'StaProtocolo' => \ProtocoloRN::$TP_DOCUMENTO_RECEBIDO, + 'StaDocumento' => \DocumentoRN::$TD_EXTERNO, + 'IdConjuntoEstilos' => NULL, + ]); + + $objAnexoFixture->carregar([ + 'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(), + 'Nome' => basename(self::$documentoTeste6['ARQUIVO']), + ]); + + //Fim das operações no BD do org2 + putenv("DATABASE_HOST=org1-database"); // Acessar sistema do this->REMETENTE do processo $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Incluir novos documentos relacionados $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); - $this->cadastrarDocumentoExterno(self::$documentoTeste6); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -209,6 +330,7 @@ public function test_devolucao_processo_para_origem() public function test_verificar_devolucao_origem_processo_anexado() { $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); @@ -243,10 +365,8 @@ public function test_verificar_devolucao_origem_processo_anexado() public function test_verificar_devolucao_destino_processo_anexado() { $strProtocoloTeste = self::$protocoloTestePrincipal; - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - - $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$destinatario['SENHA']); + $this->acessarSistema(self::$destinatario['URL'], self::$destinatario['SIGLA_UNIDADE'], self::$destinatario['LOGIN'], self::$remetente['SENHA']); $this->abrirProcesso(self::$protocoloTestePrincipal); $this->validarDadosProcesso( @@ -262,7 +382,7 @@ public function test_verificar_devolucao_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(5, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[3], self::$documentoTeste5, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[4], self::$documentoTeste6, self::$destinatario); diff --git a/tests_super/funcional/tests/TramiteProcessoAnexadoTest.php b/tests_super/funcional/tests/TramiteProcessoAnexadoTest.php index 5ebaa1cfc..3e72143cf 100755 --- a/tests_super/funcional/tests/TramiteProcessoAnexadoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoAnexadoTest.php @@ -1,5 +1,7 @@ gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + self::$documentoTeste1 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); // Definição de dados de teste do processo a ser anexado self::$processoTesteAnexado = $this->gerarDadosProcessoTeste(self::$remetente); - self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Cadastrar novo processo de teste anexado e incluir documentos relacionados - self::$protocoloTesteAnexado = $this->cadastrarProcesso(self::$processoTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); - + self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); + + $parametros = [ + [ + 'Descricao' => self::$processoTestePrincipal['DESCRICAO'], + 'Interessados' => self::$processoTestePrincipal['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste1, self::$documentoTeste2], + ], + [ + 'Descricao' => self::$processoTesteAnexado['DESCRICAO'], + 'Interessados' => self::$processoTesteAnexado['INTERESSADOS'], + 'Documentos' => [self::$documentoTeste3, self::$documentoTeste4], + ] + ]; + + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocolosDTO = $objProtocoloFixture->carregarVariados($parametros); + // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $i = 0; + foreach($objProtocolosDTO as $objProtocoloDTO) { + $objProcedimentoFixture = new ProcedimentoFixture(); + + $objProcedimentoDTO = $objProcedimentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtividadeFixture = new AtividadeFixture(); + $objAtividadeDTO = $objAtividadeFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'Conclusao' => \InfraData::getStrDataHoraAtual(), + 'IdTarefa' => \TarefaRN::$TI_GERACAO_PROCEDIMENTO, + 'IdUsuarioConclusao' => 100000001 + ]); + + $objContatoFixture = new ContatoFixture(); + $objContatoDTO = $objContatoFixture->carregar([ + 'Nome' => self::$processoTestePrincipal['INTERESSADOS'] + ]); + + $objParticipanteFixture = new ParticipanteFixture(); + $objParticipanteDTO = $objParticipanteFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdContato' => $objContatoDTO->getNumIdContato() + ]); + + $objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture(); + $objProtocoloAssuntoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo() + ]); + + $objAtributoAndamentoFixture = new AtributoAndamentoFixture(); + $objAtributoAndamentoFixture->carregar([ + 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() + ]); + + // Incluir e assinar documentos relacionados + foreach($parametros[$i]['Documentos'] as $documento) { + $objDocumentoFixture = new DocumentoFixture(); + $objDocumentoDTO = $objDocumentoFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdProcedimento' => $objProcedimentoDTO->getDblIdProcedimento(), + 'Descricao' => $documento['DESCRICAO'], + ]); + + // Armazenar nome que o arquivo receberá no org destinatário + $docs[$i][] = str_pad($objDocumentoDTO->getDblIdDocumento(), 6, 0, STR_PAD_LEFT).'.html'; + + $objAssinaturaFixture = new AssinaturaFixture(); + $objAssinaturaFixture->carregar([ + 'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(), + 'IdDocumento' => $objDocumentoDTO->getDblIdDocumento(), + ]); + } + $protocolo[$i]['formatado'] = $objProtocoloDTO->getStrProtocoloFormatado(); + $protocolo[$i]['id'] = $objProtocoloDTO->getDblIdProtocolo(); + $i++; + } + + // Preencher variaveis que serão usadas posteriormente nos testes + self::$documentoTeste1['ARQUIVO'] = $docs[0][0]; + self::$documentoTeste2['ARQUIVO'] = $docs[0][1]; + self::$documentoTeste3['ARQUIVO'] = $docs[1][0]; + self::$documentoTeste4['ARQUIVO'] = $docs[1][1]; + self::$protocoloTestePrincipal = $protocolo[0]['formatado']; + self::$protocoloTestePrincipalId = $protocolo[0]['id']; + self::$protocoloTesteAnexado = $protocolo[1]['formatado']; + self::$protocoloTesteAnexadoId = $protocolo[1]['id']; // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); - - $this->cadastrarDocumentoExterno(self::$documentoTeste2); - + $objAnexoProcessoFixture = new AnexoProcessoFixture(); + $objAnexoProcessoFixture->carregar([ + 'IdProtocolo' => self::$protocoloTestePrincipalId, + 'IdDocumento' => self::$protocoloTesteAnexadoId, + ]); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -71,9 +154,9 @@ public function test_tramitar_processo_anexado_da_origem() self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false ); + } - - + /** * Teste de verificação do correto envio do processo anexado no sistema remetente * @@ -109,7 +192,7 @@ public function test_verificar_origem_processo_anexado() $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); } - + /** * Teste de verificação do correto recebimento do processo anexado no destinatário * @@ -143,7 +226,7 @@ public function test_verificar_destino_processo_anexado() $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); $this->assertEquals(3, count($listaDocumentosProcessoPrincipal)); $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[0], self::$documentoTeste1, self::$destinatario); - $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[2], self::$documentoTeste2, self::$destinatario); + $this->validarDadosDocumento($listaDocumentosProcessoPrincipal[1], self::$documentoTeste2, self::$destinatario); $this->paginaProcesso->selecionarDocumento(self::$protocoloTesteAnexado); $this->assertTrue($this->paginaDocumento->ehProcessoAnexado()); diff --git a/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php b/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php index 4774100f4..a4d714d8e 100755 --- a/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php +++ b/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php @@ -1,5 +1,7 @@ gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1, self::$documentoTeste2); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); self::$protocoloTesteAnexado = self::$processoTesteAnexado["PROTOCOLO"]; } @@ -84,15 +87,18 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + // Selecionar banco do org2 para fazer inserção dos documentos + putenv("DATABASE_HOST=org2-database"); self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // Incluir novos documentos relacionados no processo anexado - $this->abrirProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); + // Busca ID que Protocolo principal recebeu no org2 + $parametros = [ + 'ProtocoloFormatado' => self::$protocoloTesteAnexado, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloAnexadoDTO = $objProtocoloFixture->buscar($parametros)[0]; + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloAnexadoDTO->getDblIdProtocolo()); // Gerar dados de testes para representar o processo principal self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); @@ -100,14 +106,25 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); // Cadastra processo principal, seus documentos e anexa processo recebido anteriormente - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoInterno(self::$documentoTeste4); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $objProtocoloPrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = $objProtocoloPrincipalDTO->getStrProtocoloFormatado(); + + // Cadastra e assina + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste4,$objProtocoloPrincipalDTO->getDblIdProtocolo()); - $this->anexarProcesso(self::$protocoloTesteAnexado); + // $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); + $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloPrincipalDTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + // Abre processo principal para tramitar + $this->abrirProcesso(self::$protocoloTestePrincipal); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente(