From a1dc73f25841c7975cc98dbd770714b12b13191e Mon Sep 17 00:00:00 2001 From: Marcus Dias <31357298+marvdias@users.noreply.github.com> Date: Tue, 27 Aug 2024 20:24:34 -0300 Subject: [PATCH] tests: refatoracao testes funcionais (#570) * tests: refatoracao testes funcionais * chore: remover codigo comentado * chore: remover codigo comentado --- .../tests/FixtureCenarioBaseTestCase.php | 4 +- ...teProcessoComDevolucaoAnexadoOutroTest.php | 2 - ...ContendoDocumentoExternoMesmoOrgaoTest.php | 4 +- ...ntendoDocumentoExternoParticionadoTest.php | 19 +- ...oContendoDocumentoGeradoMesmoOrgaoTest.php | 4 +- ...iteProcessoContendoDocumentoGeradoTest.php | 20 +- ...ssoContendoDocumentoInternoExternoTest.php | 33 +- ...essoContendoDocumentoMovidoDestinoTest.php | 52 +-- .../tests/FixtureCenarioBaseTestCase.php | 4 +- ...ContendoDocumentoExternoMesmoOrgaoTest.php | 4 +- ...ntendoDocumentoExternoParticionadoTest.php | 19 +- ...oContendoDocumentoGeradoMesmoOrgaoTest.php | 4 +- ...iteProcessoContendoDocumentoGeradoTest.php | 20 +- ...ssoContendoDocumentoInternoExternoTest.php | 33 +- ...ProcessoContendoDocumentoMovidoDestino.php | 339 ------------------ ...essoContendoDocumentoMovidoDestinoTest.php | 52 +-- .../tests/FixtureCenarioBaseTestCase.php | 12 +- ...teProcessoComDevolucaoAnexadoOutroTest.php | 2 - ...ContendoDocumentoExternoMesmoOrgaoTest.php | 4 +- ...ntendoDocumentoExternoParticionadoTest.php | 20 +- ...oContendoDocumentoGeradoMesmoOrgaoTest.php | 4 +- ...iteProcessoContendoDocumentoGeradoTest.php | 20 +- ...ssoContendoDocumentoInternoExternoTest.php | 33 +- ...essoContendoDocumentoMovidoDestinoTest.php | 52 +-- 24 files changed, 250 insertions(+), 510 deletions(-) delete mode 100644 tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestino.php diff --git a/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php index fcb43c161..0b53bb24b 100755 --- a/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php @@ -57,7 +57,7 @@ protected function cadastrarProcessoFixture(&$dadosProcesso) 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() ]); - $dadosProcesso['PROTOCOLO'] = $protocoloGerado; + $dadosProcesso['PROTOCOLO'] = $objProtocoloDTO->getStrProtocoloFormatado(); return $objProtocoloDTO; } @@ -136,7 +136,7 @@ protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) 'ProtocoloFormatado' => $protocoloFormatado, 'StaProtocolo' => $staProtocolo ?: \ProtocoloRN::$TP_DOCUMENTO_GERADO, ]); - return $objProtocoloDTO; + return $objProtocoloDTO[0]; } protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) diff --git a/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php b/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php index a4d714d8e..81082f33f 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php @@ -112,8 +112,6 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() // Cadastra e assina $this->cadastrarDocumentoInternoFixture(self::$documentoTeste4,$objProtocoloPrincipalDTO->getDblIdProtocolo()); - // $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloPrincipalDTO->getDblIdProtocolo()); diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php index 297b027bd..29cecc3b6 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_alone_group5 */ -class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -34,7 +34,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php index 1b8aca228..a9bb728db 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php @@ -5,7 +5,7 @@ * @group rodarseparado2 * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoParticionadoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -14,7 +14,7 @@ class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBas public static $protocoloTeste; public static function setUpBeforeClass() :void { - + parent::setUpBeforeClass(); $bancoOrgaoA = new DatabaseUtils(CONTEXTO_ORGAO_A); $bancoOrgaoA->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); @@ -47,20 +47,27 @@ public function test_tramitar_processo_contendo_documento_externo_60mb() // Configuração do dados para teste do cenário self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); + self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_060.pdf'); - - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); // Altera tamanho máximo permitido para permitir o envio de arquivo superior à 50MBs $bancoOrgaoB = new DatabaseUtils(CONTEXTO_ORGAO_B); try { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); } finally { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(50, 'SEI_TAM_MB_DOC_EXTERNO')); } + putenv("DATABASE_HOST=org1-database"); + + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + $this->abrirProcesso(self::$protocoloTeste); $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php index 207f9c74d..2e2ccb15d 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -33,7 +33,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php index a6a71c581..ed7cfb0c8 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoGeradoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -30,17 +30,19 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir Documentos no Processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // 3 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // 5 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php index f9d8e5b1f..6ce296f64 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoInternoExternoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoInternoExternoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -32,20 +32,23 @@ public function test_tramitar_processo_contendo_documento_interno_externo() self::$documentoInternoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoExternoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir e assinar documentos no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoInternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 3 - Incluir documento externo ao processo + $this->cadastrarDocumentoExternoFixture(self::$documentoExternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir e assinar documentos no processo - $this->cadastrarDocumentoInterno(self::$documentoInternoTeste); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Incluir documento externo ao processo - $this->cadastrarDocumentoExterno(self::$documentoExternoTeste); + // 5 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); - // 5 - Trâmitar Externamento processo para órgão/unidade destinatária + // 6 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -70,7 +73,7 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern $this->abrirProcesso(self::$protocoloTeste); - // 6 - Verificar se situação atual do processo está como bloqueado + // 7 - Verificar se situação atual do processo está como bloqueado $this->waitUntil(function($testCase) use (&$orgaosDiferentes) { sleep(5); $this->atualizarTramitesPEN(); @@ -82,15 +85,15 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern return true; }, PEN_WAIT_TIMEOUT); - // 7 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) + // 8 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTeste, $unidade); $this->validarRecibosTramite($mensagemRecibo, true, true); - // 8 - Validar histórico de trâmite do processo + // 9 - Validar histórico de trâmite do processo $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - // 9 - Verificar se processo está na lista de Processos Tramitados Externamente + // 10 - Verificar se processo está na lista de Processos Tramitados Externamente $this->validarProcessosTramitados(self::$protocoloTeste, $orgaosDiferentes); } diff --git a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php index 1d6e908db..d5482b5a6 100644 --- a/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php @@ -32,7 +32,7 @@ * Execution Groups * @group exxecute_parallel */ -class TramiteProcessoContendoDocumentoMovidoDestinoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoMovidoDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -47,6 +47,10 @@ class TramiteProcessoContendoDocumentoMovidoDestinoTest extends CenarioBaseTestC public static $documentoTeste5; public static $documentoTeste6; public static $documentoTeste7; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTestePrincipalOrg2DTO; + + /* Escopo da função: @@ -68,27 +72,30 @@ public function test_criar_processo_contendo_documentos_tramitar_remetente() self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - // acessar remetente (Órgão 1) - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // 1-criar Processo Principal ($processoTestePrincipal) (Órgão 1) self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); + // $this->paginaBase->navegarParaControleProcesso(); + self::$objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = self::$objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); // 2-criar Documento Externo (documentoTeste1) no Processo Principal self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste1, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 3-criar Documento Interno (documentoTeste2) no Processo Principal self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste2); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste2, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 4-criar Documento Interno (documentoTeste3) no Processo Principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste3); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste3, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + // acessar remetente (Órgão 1) + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + // Abrir processo + $this->abrirProcesso(self::$protocoloTestePrincipal); // 5-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -146,9 +153,11 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); // 7-criar Processo Secundário ($processoTesteSecundario) (Órgão 2) + putenv("DATABASE_HOST=org2-database"); self::$processoTesteSecundario = $this->gerarDadosProcessoTeste(self::$remetente); - self::$protocoloTesteSecundario = $this->cadastrarProcesso(self::$processoTesteSecundario); - + $objProtocoloSecundarioDTO = $this->cadastrarProcessoFixture(self::$processoTesteSecundario); + self::$protocoloTesteSecundario = $objProtocoloSecundarioDTO->getStrProtocoloFormatado(); + // abrir Processo Principal $this->abrirProcesso(self::$protocoloTestePrincipal); @@ -166,15 +175,18 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( $this->paginaDocumento->navegarParaMoverDocumento(); $this->paginaMoverDocumento->moverDocumentoParaProcesso(self::$protocoloTesteSecundario, "Motivo de teste"); + // Consultar processo org-2 + self::$objProtocoloTestePrincipalOrg2DTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, $staProtocolo = 'P'); + // 10-criar documento externo (documentoTeste4) no Processo Principal self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste4, self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); // 11-criar documento interno (documentoTeste5) no Processo Principal self::$documentoTeste5 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste5); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste5,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); // 12-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -231,8 +243,7 @@ public function test_incluir_documento_tramitar_destinatario() // 14-criar documento interno (documentoTeste6) no Processo Principal self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 15-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -284,12 +295,13 @@ public function test_incluir_documento_tramitar_remetente() // definir Órgão 1 como destinatário e Órgão 2 como remetente self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // 17-criar documento interno (documentoTeste7) no Processo Principal self::$documentoTeste7 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste7); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste7,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + putenv("DATABASE_HOST=org1-database"); // 18-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); diff --git a/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php index fcb43c161..0b53bb24b 100755 --- a/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php @@ -57,7 +57,7 @@ protected function cadastrarProcessoFixture(&$dadosProcesso) 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() ]); - $dadosProcesso['PROTOCOLO'] = $protocoloGerado; + $dadosProcesso['PROTOCOLO'] = $objProtocoloDTO->getStrProtocoloFormatado(); return $objProtocoloDTO; } @@ -136,7 +136,7 @@ protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) 'ProtocoloFormatado' => $protocoloFormatado, 'StaProtocolo' => $staProtocolo ?: \ProtocoloRN::$TP_DOCUMENTO_GERADO, ]); - return $objProtocoloDTO; + return $objProtocoloDTO[0]; } protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php index de73ca25c..57c165e0d 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -34,7 +34,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php index 1b8aca228..a9bb728db 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php @@ -5,7 +5,7 @@ * @group rodarseparado2 * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoParticionadoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -14,7 +14,7 @@ class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBas public static $protocoloTeste; public static function setUpBeforeClass() :void { - + parent::setUpBeforeClass(); $bancoOrgaoA = new DatabaseUtils(CONTEXTO_ORGAO_A); $bancoOrgaoA->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); @@ -47,20 +47,27 @@ public function test_tramitar_processo_contendo_documento_externo_60mb() // Configuração do dados para teste do cenário self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); + self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_060.pdf'); - - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); // Altera tamanho máximo permitido para permitir o envio de arquivo superior à 50MBs $bancoOrgaoB = new DatabaseUtils(CONTEXTO_ORGAO_B); try { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); } finally { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(50, 'SEI_TAM_MB_DOC_EXTERNO')); } + putenv("DATABASE_HOST=org1-database"); + + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + $this->abrirProcesso(self::$protocoloTeste); $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php index 207f9c74d..2e2ccb15d 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -33,7 +33,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php index a6a71c581..ed7cfb0c8 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoGeradoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -30,17 +30,19 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir Documentos no Processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // 3 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // 5 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php index f9d8e5b1f..6ce296f64 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoInternoExternoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoInternoExternoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -32,20 +32,23 @@ public function test_tramitar_processo_contendo_documento_interno_externo() self::$documentoInternoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoExternoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir e assinar documentos no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoInternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 3 - Incluir documento externo ao processo + $this->cadastrarDocumentoExternoFixture(self::$documentoExternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir e assinar documentos no processo - $this->cadastrarDocumentoInterno(self::$documentoInternoTeste); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Incluir documento externo ao processo - $this->cadastrarDocumentoExterno(self::$documentoExternoTeste); + // 5 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); - // 5 - Trâmitar Externamento processo para órgão/unidade destinatária + // 6 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -70,7 +73,7 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern $this->abrirProcesso(self::$protocoloTeste); - // 6 - Verificar se situação atual do processo está como bloqueado + // 7 - Verificar se situação atual do processo está como bloqueado $this->waitUntil(function($testCase) use (&$orgaosDiferentes) { sleep(5); $this->atualizarTramitesPEN(); @@ -82,15 +85,15 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern return true; }, PEN_WAIT_TIMEOUT); - // 7 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) + // 8 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTeste, $unidade); $this->validarRecibosTramite($mensagemRecibo, true, true); - // 8 - Validar histórico de trâmite do processo + // 9 - Validar histórico de trâmite do processo $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - // 9 - Verificar se processo está na lista de Processos Tramitados Externamente + // 10 - Verificar se processo está na lista de Processos Tramitados Externamente $this->validarProcessosTramitados(self::$protocoloTeste, $orgaosDiferentes); } diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestino.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestino.php deleted file mode 100644 index 89519c65f..000000000 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestino.php +++ /dev/null @@ -1,339 +0,0 @@ -definirContextoTeste(CONTEXTO_ORGAO_A); - self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - - // acessar remetente (Órgão 1) - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // 1-criar Processo Principal ($processoTestePrincipal) (Órgão 1) - self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - - // 2-criar Documento Externo (documentoTeste1) no Processo Principal - self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); - - // 3-criar Documento Interno (documentoTeste2) no Processo Principal - self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste2); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - - // 4-criar Documento Interno (documentoTeste3) no Processo Principal - self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste3); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - - // 5-tramitar Processo Principal para o Órgão 2 com validação no remetente - $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); - - // verificar se situação atual do processo está como bloqueado no remetente - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - $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); - - // validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) - $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); - $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTestePrincipal, $unidade); - $this->validarRecibosTramite($mensagemRecibo, true, true); - - // validar histórico de trâmite do processo - $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - - // verificar se processo está na lista de Processos Tramitados Externamente - $deveExistir = self::$remetente['URL'] != self::$destinatario['URL']; - $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); - } - - /* - Escopo da função: - Órgão 2: - 6-verificar correto recebimento do processo e seus documentos no destino (Órgão 2) - 7-criar Processo Secundário ($processoTesteSecundario) (Órgão 2) - 8-mover documento externo (documentoTeste1) do Processo Principal para o Processo Secundário - 9-mover documento interno (documentoTeste2) do Processo Principal para o Processo Secundário - 10-criar documento externo (documentoTeste4) no Processo Principal - 11-criar documento interno (documentoTeste5) no Processo Principal - 12-tramitar Processo Principal para o Órgão 1 com validação no remetente - - @group TramiteProcessoContendoDocumentoMovidoDestino - @large - @depends test_criar_processo_contendo_documentos_tramitar_remetente - @return void - */ - public function test_criar_mover_incluir_documentos_devolver_processo_remetente() - { - // 6-verificar correto recebimento do processo e seus documentos no destino (Órgão 2) - $documentos = array(self::$documentoTeste1, self::$documentoTeste2, self::$documentoTeste3); - $this->realizarValidacaoRecebimentoProcessoNoDestinatario(self::$processoTestePrincipal, $documentos, self::$destinatario); - - // definir Órgão 1 como destinatário e Órgão 2 como remetente - self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); - - // 7-criar Processo Secundário ($processoTesteSecundario) (Órgão 2) - self::$processoTesteSecundario = $this->gerarDadosProcessoTeste(self::$remetente); - self::$protocoloTesteSecundario = $this->cadastrarProcesso(self::$processoTesteSecundario); - - // abrir Processo Principal - $this->abrirProcesso(self::$protocoloTestePrincipal); - - // listar documentos do Processo Principal - $listaDocumentosProcessoPrincipal = $this->paginaProcesso->listarDocumentos(); - $this->assertEquals(3, count($listaDocumentosProcessoPrincipal)); - - // 8-mover documento externo (documentoTeste1) do Processo Principal para o Processo Secundário - $this->paginaProcesso->selecionarDocumento($listaDocumentosProcessoPrincipal[0]); - $this->paginaDocumento->navegarParaMoverDocumento(); - $this->paginaMoverDocumento->moverDocumentoParaProcesso(self::$protocoloTesteSecundario, "Motivo de teste"); - - // 9-mover documento interno (documentoTeste2) do Processo Principal para o Processo Secundário - $this->paginaProcesso->selecionarDocumento($listaDocumentosProcessoPrincipal[1]); - $this->paginaDocumento->navegarParaMoverDocumento(); - $this->paginaMoverDocumento->moverDocumentoParaProcesso(self::$protocoloTesteSecundario, "Motivo de teste"); - - // 10-criar documento externo (documentoTeste4) no Processo Principal - self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); - - // 11-criar documento interno (documentoTeste5) no Processo Principal - self::$documentoTeste5 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste5); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - - // 12-tramitar Processo Principal para o Órgão 1 com validação no remetente - $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); - - // verificar se situação atual do processo está como bloqueado no remetente - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - $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); - - // validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) - $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); - $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTestePrincipal, $unidade); - $this->validarRecibosTramite($mensagemRecibo, true, true); - - // validar histórico de trâmite do processo - $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - - // verificar se processo está na lista de Processos Tramitados Externamente - $deveExistir = self::$remetente['URL'] != self::$destinatario['URL']; - $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); - } - - /* - Escopo da função: - Órgão 1: - 13-verificar correto recebimento do processo no destino (Órgão 1) - 14-criar documento interno (documentoTeste6) no Processo Principal - 15-tramitar Processo Principal para o Órgão 2 com validação no remetente - - @group TramiteProcessoContendoDocumentoMovidoDestino - @large - @depends test_criar_mover_incluir_documentos_devolver_processo_remetente - @return void - */ - public function test_incluir_documento_tramitar_destinatario() - { - // 13-verificar correto recebimento do processo no destino (Órgão 1) - $documentos = array(self::$documentoTeste1, self::$documentoTeste2, self::$documentoTeste3, self::$documentoTeste4, self::$documentoTeste5); - $this->realizarValidacaoRecebimentoProcessoNoDestinatario(self::$processoTestePrincipal, $documentos, self::$destinatario); - - // definir Órgão 1 como remetente e Órgão 2 como destinatário - self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); - self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - - // abrir Processo Principal - $this->abrirProcesso(self::$protocoloTestePrincipal); - - // 14-criar documento interno (documentoTeste6) no Processo Principal - self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - - // 15-tramitar Processo Principal para o Órgão 2 com validação no remetente - $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); - - // verificar se situação atual do processo está como bloqueado no remetente - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - $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); - - // validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) - $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); - $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTestePrincipal, $unidade); - $this->validarRecibosTramite($mensagemRecibo, true, true); - - // validar histórico de trâmite do processo - $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - - // verificar se processo está na lista de Processos Tramitados Externamente - $deveExistir = self::$remetente['URL'] != self::$destinatario['URL']; - $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); - } - - /* - Escopo da função: - Órgão 2: - 16-verificar correto recebimento do processo no destino (Órgão 2) - 17-criar documento interno (documentoTeste7) no Processo Principal - 18-tramitar Processo Principal para o Órgão 1 com validação no remetente - - @group TramiteProcessoContendoDocumentoMovidoDestino - @large - @depends test_incluir_documento_tramitar_destinatario - @return void - */ - public function test_incluir_documento_tramitar_remetente() - { - // 16-verificar correto recebimento do processo no destino (Órgão 2) - $documentos = array(self::$documentoTeste1, self::$documentoTeste2, self::$documentoTeste3, self::$documentoTeste4, self::$documentoTeste5, self::$documentoTeste6); - $this->realizarValidacaoRecebimentoProcessoNoDestinatario(self::$processoTestePrincipal, $documentos, self::$destinatario); - - // definir Órgão 1 como destinatário e Órgão 2 como remetente - self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); - - // 17-criar documento interno (documentoTeste7) no Processo Principal - self::$documentoTeste7 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste7); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - - // 18-tramitar Processo Principal para o Órgão 1 com validação no remetente - $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); - - // verificar se situação atual do processo está como bloqueado no remetente - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; - $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); - - // validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) - $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); - $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTestePrincipal, $unidade); - $this->validarRecibosTramite($mensagemRecibo, true, true); - - // validar histórico de trâmite do processo - $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - - // verificar se processo está na lista de Processos Tramitados Externamente - $deveExistir = self::$remetente['URL'] != self::$destinatario['URL']; - $this->validarProcessosTramitados(self::$protocoloTestePrincipal, $orgaosDiferentes); - } - - /* - Escopo da função: - Órgão 1: - 19-verificar correto recebimento do processo no destino (Órgão 1) - - @group TramiteProcessoContendoDocumentoMovidoDestino - @large - @depends test_incluir_documento_tramitar_remetente - @return void - */ - public function test_verificar_processo_documento_destino() - { - // 19-verificar correto recebimento do processo no destino (Órgão 1) - $documentos = array(self::$documentoTeste1, self::$documentoTeste2, self::$documentoTeste3, self::$documentoTeste4, self::$documentoTeste5, self::$documentoTeste6, self::$documentoTeste7); - $this->realizarValidacaoRecebimentoProcessoNoDestinatario(self::$processoTestePrincipal, $documentos, self::$destinatario); - } - -} \ No newline at end of file diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php index 1d6e908db..64d81da74 100644 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php @@ -32,7 +32,7 @@ * Execution Groups * @group exxecute_parallel */ -class TramiteProcessoContendoDocumentoMovidoDestinoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoMovidoDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -47,6 +47,10 @@ class TramiteProcessoContendoDocumentoMovidoDestinoTest extends CenarioBaseTestC public static $documentoTeste5; public static $documentoTeste6; public static $documentoTeste7; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTestePrincipalOrg2DTO; + + /* Escopo da função: @@ -68,27 +72,30 @@ public function test_criar_processo_contendo_documentos_tramitar_remetente() self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - // acessar remetente (Órgão 1) - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // 1-criar Processo Principal ($processoTestePrincipal) (Órgão 1) self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); + // $this->paginaBase->navegarParaControleProcesso(); + self::$objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = self::$objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); // 2-criar Documento Externo (documentoTeste1) no Processo Principal self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste1, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 3-criar Documento Interno (documentoTeste2) no Processo Principal self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste2); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste2, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 4-criar Documento Interno (documentoTeste3) no Processo Principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste3); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste3, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + // acessar remetente (Órgão 1) + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + // Abrir processo + $this->abrirProcesso(self::$protocoloTestePrincipal); // 5-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -146,9 +153,11 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); // 7-criar Processo Secundário ($processoTesteSecundario) (Órgão 2) + putenv("DATABASE_HOST=org2-database"); self::$processoTesteSecundario = $this->gerarDadosProcessoTeste(self::$remetente); - self::$protocoloTesteSecundario = $this->cadastrarProcesso(self::$processoTesteSecundario); - + $objProtocoloSecundarioDTO = $this->cadastrarProcessoFixture(self::$processoTesteSecundario); + self::$protocoloTesteSecundario = $objProtocoloSecundarioDTO->getStrProtocoloFormatado(); + // abrir Processo Principal $this->abrirProcesso(self::$protocoloTestePrincipal); @@ -166,15 +175,18 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( $this->paginaDocumento->navegarParaMoverDocumento(); $this->paginaMoverDocumento->moverDocumentoParaProcesso(self::$protocoloTesteSecundario, "Motivo de teste"); + // Consultar processo org-2 + self::$objProtocoloTestePrincipalOrg2DTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, $staProtocolo = 'P'); + // 10-criar documento externo (documentoTeste4) no Processo Principal self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste4, self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); // 11-criar documento interno (documentoTeste5) no Processo Principal self::$documentoTeste5 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste5); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste5,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); // 12-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -231,8 +243,7 @@ public function test_incluir_documento_tramitar_destinatario() // 14-criar documento interno (documentoTeste6) no Processo Principal self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 15-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -284,12 +295,13 @@ public function test_incluir_documento_tramitar_remetente() // definir Órgão 1 como destinatário e Órgão 2 como remetente self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // 17-criar documento interno (documentoTeste7) no Processo Principal self::$documentoTeste7 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste7); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste7,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + putenv("DATABASE_HOST=org1-database"); // 18-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); diff --git a/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php index 51c1c6175..d43d457c1 100755 --- a/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php @@ -57,7 +57,7 @@ protected function cadastrarProcessoFixture(&$dadosProcesso) 'IdAtividade' => $objAtividadeDTO->getNumIdAtividade() ]); - $dadosProcesso['PROTOCOLO'] = $protocoloGerado; + $dadosProcesso['PROTOCOLO'] = $objProtocoloDTO->getStrProtocoloFormatado(); return $objProtocoloDTO; } @@ -129,6 +129,16 @@ protected function anexarProcessoFixture($protocoloPrincipalId, $protocoloProces ]); } + protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) + { + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloDTO = $objProtocoloFixture->buscar([ + 'ProtocoloFormatado' => $protocoloFormatado, + 'StaProtocolo' => $staProtocolo ?: \ProtocoloRN::$TP_DOCUMENTO_GERADO, + ]); + return $objProtocoloDTO[0]; + } + protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) { $orgaosDiferentes = $remetente['URL'] != $destinatario['URL']; diff --git a/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php b/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php index a4d714d8e..81082f33f 100755 --- a/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php +++ b/tests_super/funcional/tests/TramiteProcessoComDevolucaoAnexadoOutroTest.php @@ -112,8 +112,6 @@ public function test_devolucao_processo_anexado_em_outro_para_origem() // Cadastra e assina $this->cadastrarDocumentoInternoFixture(self::$documentoTeste4,$objProtocoloPrincipalDTO->getDblIdProtocolo()); - // $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloPrincipalDTO->getDblIdProtocolo()); diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php index de73ca25c..57c165e0d 100755 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -34,7 +34,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php index 31bdf5678..a9bb728db 100755 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoExternoParticionadoTest.php @@ -5,7 +5,7 @@ * @group rodarseparado2 * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoParticionadoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -14,7 +14,8 @@ class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBas public static $protocoloTeste; public static function setUpBeforeClass() :void { - + + parent::setUpBeforeClass(); $bancoOrgaoA = new DatabaseUtils(CONTEXTO_ORGAO_A); $bancoOrgaoA->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); @@ -46,20 +47,27 @@ public function test_tramitar_processo_contendo_documento_externo_60mb() // Configuração do dados para teste do cenário self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); + self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_060.pdf'); - - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); // Altera tamanho máximo permitido para permitir o envio de arquivo superior à 50MBs $bancoOrgaoB = new DatabaseUtils(CONTEXTO_ORGAO_B); try { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(70, 'SEI_TAM_MB_DOC_EXTERNO')); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); } finally { $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(50, 'SEI_TAM_MB_DOC_EXTERNO')); } + putenv("DATABASE_HOST=org1-database"); + + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + $this->abrirProcesso(self::$protocoloTeste); $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php index 207f9c74d..2e2ccb15d 100755 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -33,7 +33,7 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$destinatario['NOME_UNIDADE'] = self::$remetente['NOME_UNIDADE_SECUNDARIA']; self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'] = self::$remetente['SIGLA_UNIDADE_SECUNDARIA_HIERARQUIA']; - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php index a6a71c581..ed7cfb0c8 100755 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoGeradoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_alone_group1 */ -class TramiteProcessoContendoDocumentoGeradoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoGeradoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -30,17 +30,19 @@ public function test_tramitar_processo_contendo_documento_gerado() self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir Documentos no Processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // 3 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // 5 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php index f9d8e5b1f..6ce296f64 100755 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoInternoExternoTest.php @@ -4,7 +4,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoInternoExternoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoInternoExternoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -32,20 +32,23 @@ public function test_tramitar_processo_contendo_documento_interno_externo() self::$documentoInternoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoExternoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // 1 - Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + // 2 - Incluir e assinar documentos no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoInternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + // 3 - Incluir documento externo ao processo + $this->cadastrarDocumentoExternoFixture(self::$documentoExternoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // 3 - Incluir e assinar documentos no processo - $this->cadastrarDocumentoInterno(self::$documentoInternoTeste); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 4 - Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // 4 - Incluir documento externo ao processo - $this->cadastrarDocumentoExterno(self::$documentoExternoTeste); + // 5 - Abrir processo + $this->abrirProcesso(self::$protocoloTeste); - // 5 - Trâmitar Externamento processo para órgão/unidade destinatária + // 6 - Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -70,7 +73,7 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern $this->abrirProcesso(self::$protocoloTeste); - // 6 - Verificar se situação atual do processo está como bloqueado + // 7 - Verificar se situação atual do processo está como bloqueado $this->waitUntil(function($testCase) use (&$orgaosDiferentes) { sleep(5); $this->atualizarTramitesPEN(); @@ -82,15 +85,15 @@ public function test_verificar_origem_processo_contendo_documento_interno_extern return true; }, PEN_WAIT_TIMEOUT); - // 7 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) + // 8 - Validar se recibo de trâmite foi armazenado para o processo (envio e conclusão) $unidade = mb_convert_encoding(self::$destinatario['NOME_UNIDADE'], "ISO-8859-1"); $mensagemRecibo = sprintf("Trâmite externo do Processo %s para %s", self::$protocoloTeste, $unidade); $this->validarRecibosTramite($mensagemRecibo, true, true); - // 8 - Validar histórico de trâmite do processo + // 9 - Validar histórico de trâmite do processo $this->validarHistoricoTramite(self::$destinatario['NOME_UNIDADE'], true, true); - // 9 - Verificar se processo está na lista de Processos Tramitados Externamente + // 10 - Verificar se processo está na lista de Processos Tramitados Externamente $this->validarProcessosTramitados(self::$protocoloTeste, $orgaosDiferentes); } diff --git a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php index 89519c65f..64d81da74 100644 --- a/tests_super/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoContendoDocumentoMovidoDestinoTest.php @@ -32,7 +32,7 @@ * Execution Groups * @group exxecute_parallel */ -class TramiteProcessoContendoDocumentoMovidoDestino extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoMovidoDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -47,6 +47,10 @@ class TramiteProcessoContendoDocumentoMovidoDestino extends CenarioBaseTestCase public static $documentoTeste5; public static $documentoTeste6; public static $documentoTeste7; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTestePrincipalOrg2DTO; + + /* Escopo da função: @@ -68,27 +72,30 @@ public function test_criar_processo_contendo_documentos_tramitar_remetente() self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - // acessar remetente (Órgão 1) - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // 1-criar Processo Principal ($processoTestePrincipal) (Órgão 1) self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente); - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); + // $this->paginaBase->navegarParaControleProcesso(); + self::$objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = self::$objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); // 2-criar Documento Externo (documentoTeste1) no Processo Principal self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste1, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 3-criar Documento Interno (documentoTeste2) no Processo Principal self::$documentoTeste2 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste2); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste2, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 4-criar Documento Interno (documentoTeste3) no Processo Principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste3); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste3, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + // acessar remetente (Órgão 1) + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + + // Abrir processo + $this->abrirProcesso(self::$protocoloTestePrincipal); // 5-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -146,9 +153,11 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); // 7-criar Processo Secundário ($processoTesteSecundario) (Órgão 2) + putenv("DATABASE_HOST=org2-database"); self::$processoTesteSecundario = $this->gerarDadosProcessoTeste(self::$remetente); - self::$protocoloTesteSecundario = $this->cadastrarProcesso(self::$processoTesteSecundario); - + $objProtocoloSecundarioDTO = $this->cadastrarProcessoFixture(self::$processoTesteSecundario); + self::$protocoloTesteSecundario = $objProtocoloSecundarioDTO->getStrProtocoloFormatado(); + // abrir Processo Principal $this->abrirProcesso(self::$protocoloTestePrincipal); @@ -166,15 +175,18 @@ public function test_criar_mover_incluir_documentos_devolver_processo_remetente( $this->paginaDocumento->navegarParaMoverDocumento(); $this->paginaMoverDocumento->moverDocumentoParaProcesso(self::$protocoloTesteSecundario, "Motivo de teste"); + // Consultar processo org-2 + self::$objProtocoloTestePrincipalOrg2DTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, $staProtocolo = 'P'); + // 10-criar documento externo (documentoTeste4) no Processo Principal self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - $this->cadastrarDocumentoExterno(self::$documentoTeste4); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste4, self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); // 11-criar documento interno (documentoTeste5) no Processo Principal self::$documentoTeste5 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste5); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); - + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste5,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); // 12-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -231,8 +243,7 @@ public function test_incluir_documento_tramitar_destinatario() // 14-criar documento interno (documentoTeste6) no Processo Principal self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, self::$objProtocoloTestePrincipalDTO->getDblIdProtocolo()); // 15-tramitar Processo Principal para o Órgão 2 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); @@ -284,12 +295,13 @@ public function test_incluir_documento_tramitar_remetente() // definir Órgão 1 como destinatário e Órgão 2 como remetente self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // 17-criar documento interno (documentoTeste7) no Processo Principal self::$documentoTeste7 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - $this->cadastrarDocumentoInterno(self::$documentoTeste7); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste7,self::$objProtocoloTestePrincipalOrg2DTO->getDblIdProtocolo()); + putenv("DATABASE_HOST=org1-database"); // 18-tramitar Processo Principal para o Órgão 1 com validação no remetente $this->tramitarProcessoExternamente(self::$protocoloTestePrincipal, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false);