diff --git a/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php index 2fce72abe..38fcb5ea1 100755 --- a/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php @@ -5,6 +5,7 @@ use Tests\Funcional\Sei\Fixtures\{ProtocoloFixture,ProcedimentoFixture,AtividadeFixture,ContatoFixture}; use Tests\Funcional\Sei\Fixtures\{ParticipanteFixture,RelProtocoloAssuntoFixture,AtributoAndamentoFixture}; use Tests\Funcional\Sei\Fixtures\{DocumentoFixture,AssinaturaFixture,AnexoFixture,AnexoProcessoFixture}; +use Tests\Funcional\Sei\Fixtures\{HipoteseLegalFixture}; use function PHPSTORM_META\map; /** @@ -14,9 +15,21 @@ class FixtureCenarioBaseTestCase extends CenarioBaseTestCase { protected function cadastrarProcessoFixture(&$dadosProcesso) { + + if (!is_null($dadosProcesso['HIPOTESE_LEGAL'])){ + $param = [ + 'Nome' => trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[0]), + 'BaseLegal' => explode(')',trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[1]))[0] + ]; + $objHipLegalFixture = new HipoteseLegalFixture(); + $objHipLegalDTO = $objHipLegalFixture->buscar($param)[0]; + } + $parametros = [ 'Descricao' => $dadosProcesso['DESCRICAO'] ?: util::random_string(20), 'Interessados' => $dadosProcesso['INTERESSADOS'] ?: util::random_string(40), + 'IdHipoteseLegal' => $dadosProcesso['HIPOTESE_LEGAL'] ? $objHipLegalDTO->getNumIdHipoteseLegal() : null, + 'StaNivelAcessoLocal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO, 'StaNivelAcessoGlobal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO ]; $objProtocoloFixture = new ProtocoloFixture(); @@ -113,7 +126,7 @@ protected function anexarProcessoFixture($protocoloPrincipalId, $protocoloProces 'IdDocumento' => $protocoloProcessoAnexadoId, ]); } - + protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) { $objProtocoloFixture = new ProtocoloFixture(); @@ -123,7 +136,7 @@ protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) ]); return $objProtocoloDTO; } - + protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) { $orgaosDiferentes = $remetente['URL'] != $destinatario['URL']; @@ -170,7 +183,6 @@ protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTes // 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()); diff --git a/tests_sei4/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php b/tests_sei4/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php index 0256ba747..d7b7e2598 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoHipotesePadraoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoHipotesePadraoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -35,17 +35,18 @@ public function test_tramitar_processo_restrito_hipotese_nao_mapeada() self::$processoTeste["RESTRICAO"] = PaginaIniciarProcesso::STA_NIVEL_ACESSO_RESTRITO; self::$processoTeste["HIPOTESE_LEGAL"] = self::$remetente["HIPOTESE_RESTRICAO_NAO_MAPEADO"]; - // 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 - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei4/funcional/tests/TramiteProcessoRestritoTest.php b/tests_sei4/funcional/tests/TramiteProcessoRestritoTest.php index ca494deb4..24687cd65 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoRestritoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoRestritoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -40,13 +40,14 @@ public function test_tramitar_processo_restrito() $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei4/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php b/tests_sei4/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php index 522ff5d84..14000e503 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_alone_group3 */ -class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends CenarioBaseTestCase +class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -22,7 +22,6 @@ class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends CenarioBaseTestCase */ public static function setUpBeforeClass() :void { - parent::setUpBeforeClass(); // Redução de limite máximo de tamanho de documento externo $bancoOrgaoB = new DatabaseUtils(CONTEXTO_ORGAO_B); $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(2, 'SEI_TAM_MB_DOC_EXTERNO')); @@ -54,10 +53,17 @@ public function test_tramitar_processo_tamanho_acima_limite_destino() self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_003.pdf'); + + // Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + + $this->abrirProcesso(self::$protocoloTeste); + $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); diff --git a/tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php b/tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php similarity index 81% rename from tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php rename to tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php index 2c558cfa8..2a38b86be 100755 --- a/tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php +++ b/tests_sei4/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php @@ -1,6 +1,6 @@ gerarDadosDocumentoInternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1); - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; $paginaProcesso = new PaginaProcesso($this); diff --git a/tests_sei4/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php b/tests_sei4/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php index b5362de4a..acca4c887 100755 --- a/tests_sei4/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php @@ -6,7 +6,7 @@ * Execution Groups * @group execute_alone_group6 */ -class TramiteProcessosComDevolucaoAmbosAnexadosTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucaoAmbosAnexadosTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -44,7 +44,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1, self::$documentoTeste2); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); self::$protocoloTestePrincipal = self::$processoTestePrincipal["PROTOCOLO"]; $this->sairSistema(); @@ -55,7 +55,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); self::$protocoloTesteAnexado = self::$processoTesteAnexado["PROTOCOLO"]; } @@ -96,21 +96,30 @@ public function test_devolucao_processo_anexado_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + $objProtocoloAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); + $objProtocoloPrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + + // Cadastra documento Externo ao processo anexado + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Anexa processo ao processo principal + $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Cadastra documento Externo ao processo principal + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste6, $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']); - // Incluir novos documentos relacionados no processo anexado - $this->abrirProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); - $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->anexarProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste6); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei4/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php b/tests_sei4/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php index 460e9f7bf..14958b88a 100755 --- a/tests_sei4/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php +++ b/tests_sei4/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php @@ -15,7 +15,7 @@ * Execution Groups * @group execute_alone_group2 */ -class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucoesEAnexacoesTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -31,6 +31,11 @@ class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase public static $documentoTeste8; public static $protocoloTestePrincipal; public static $protocoloTesteAnexado; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTesteAnexadoDTO; + + + /** * Teste inicial de trâmite de processo apartado para o órgão B @@ -53,7 +58,7 @@ public function test_tramitar_processo_simples_para_orgaoB() self::$documentoTeste2 = $this->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"]; } @@ -89,13 +94,16 @@ public function test_devolucao_processo_simples_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + + putenv("DATABASE_HOST=org1-database"); } @@ -137,20 +145,23 @@ public function test_tramitar_processo_anexado_para_orgaoB() self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = $objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); + + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); - // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); + $objProtocoloTesteAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); + $this->anexarProcessoFixture($objProtocoloTestePrincipalDTO->getDblIdProtocolo(), $objProtocoloTesteAnexadoDTO->getDblIdProtocolo()); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + // 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( self::$protocoloTestePrincipal, @@ -260,6 +271,7 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste7 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); @@ -268,11 +280,16 @@ public function test_devolucao_processo_para_origem() // Acessar sistema do this->REMETENTE do processo $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // Consulta no Org2/B o DTO do Protocolo Principal + $objProtocoloTestePrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + // Incluir novos documentos relacionados + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste7, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste8, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); + $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste7); - $this->cadastrarDocumentoInterno(self::$documentoTeste8); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php index 2fce72abe..38fcb5ea1 100755 --- a/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php @@ -5,6 +5,7 @@ use Tests\Funcional\Sei\Fixtures\{ProtocoloFixture,ProcedimentoFixture,AtividadeFixture,ContatoFixture}; use Tests\Funcional\Sei\Fixtures\{ParticipanteFixture,RelProtocoloAssuntoFixture,AtributoAndamentoFixture}; use Tests\Funcional\Sei\Fixtures\{DocumentoFixture,AssinaturaFixture,AnexoFixture,AnexoProcessoFixture}; +use Tests\Funcional\Sei\Fixtures\{HipoteseLegalFixture}; use function PHPSTORM_META\map; /** @@ -14,9 +15,21 @@ class FixtureCenarioBaseTestCase extends CenarioBaseTestCase { protected function cadastrarProcessoFixture(&$dadosProcesso) { + + if (!is_null($dadosProcesso['HIPOTESE_LEGAL'])){ + $param = [ + 'Nome' => trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[0]), + 'BaseLegal' => explode(')',trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[1]))[0] + ]; + $objHipLegalFixture = new HipoteseLegalFixture(); + $objHipLegalDTO = $objHipLegalFixture->buscar($param)[0]; + } + $parametros = [ 'Descricao' => $dadosProcesso['DESCRICAO'] ?: util::random_string(20), 'Interessados' => $dadosProcesso['INTERESSADOS'] ?: util::random_string(40), + 'IdHipoteseLegal' => $dadosProcesso['HIPOTESE_LEGAL'] ? $objHipLegalDTO->getNumIdHipoteseLegal() : null, + 'StaNivelAcessoLocal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO, 'StaNivelAcessoGlobal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO ]; $objProtocoloFixture = new ProtocoloFixture(); @@ -113,7 +126,7 @@ protected function anexarProcessoFixture($protocoloPrincipalId, $protocoloProces 'IdDocumento' => $protocoloProcessoAnexadoId, ]); } - + protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) { $objProtocoloFixture = new ProtocoloFixture(); @@ -123,7 +136,7 @@ protected function consultarProcessoFixture($protocoloFormatado, $staProtocolo) ]); return $objProtocoloDTO; } - + protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTeste, $remetente, $destinatario, $validarTramite) { $orgaosDiferentes = $remetente['URL'] != $destinatario['URL']; @@ -170,7 +183,6 @@ protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTes // 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()); diff --git a/tests_sei41/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php b/tests_sei41/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php index 0256ba747..d7b7e2598 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoHipotesePadraoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoHipotesePadraoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -35,17 +35,18 @@ public function test_tramitar_processo_restrito_hipotese_nao_mapeada() self::$processoTeste["RESTRICAO"] = PaginaIniciarProcesso::STA_NIVEL_ACESSO_RESTRITO; self::$processoTeste["HIPOTESE_LEGAL"] = self::$remetente["HIPOTESE_RESTRICAO_NAO_MAPEADO"]; - // 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 - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei41/funcional/tests/TramiteProcessoRestritoTest.php b/tests_sei41/funcional/tests/TramiteProcessoRestritoTest.php index ca494deb4..24687cd65 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoRestritoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoRestritoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -40,13 +40,14 @@ public function test_tramitar_processo_restrito() $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_sei41/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php b/tests_sei41/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php index 522ff5d84..14000e503 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_alone_group3 */ -class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends CenarioBaseTestCase +class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -22,7 +22,6 @@ class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends CenarioBaseTestCase */ public static function setUpBeforeClass() :void { - parent::setUpBeforeClass(); // Redução de limite máximo de tamanho de documento externo $bancoOrgaoB = new DatabaseUtils(CONTEXTO_ORGAO_B); $bancoOrgaoB->execute("update infra_parametro set valor = ? where nome = ?", array(2, 'SEI_TAM_MB_DOC_EXTERNO')); @@ -54,10 +53,17 @@ public function test_tramitar_processo_tamanho_acima_limite_destino() self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_003.pdf'); + + // Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + + $this->abrirProcesso(self::$protocoloTeste); + $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); diff --git a/tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php b/tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php similarity index 81% rename from tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php rename to tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php index 2c558cfa8..2a38b86be 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php +++ b/tests_sei41/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php @@ -1,6 +1,6 @@ gerarDadosDocumentoInternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1); - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; $paginaProcesso = new PaginaProcesso($this); diff --git a/tests_sei41/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php b/tests_sei41/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php index b5362de4a..600095e68 100755 --- a/tests_sei41/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php @@ -6,7 +6,7 @@ * Execution Groups * @group execute_alone_group6 */ -class TramiteProcessosComDevolucaoAmbosAnexadosTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucaoAmbosAnexadosTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -44,7 +44,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1, self::$documentoTeste2); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); self::$protocoloTestePrincipal = self::$processoTestePrincipal["PROTOCOLO"]; $this->sairSistema(); @@ -55,7 +55,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); self::$protocoloTesteAnexado = self::$processoTesteAnexado["PROTOCOLO"]; } @@ -96,21 +96,30 @@ public function test_devolucao_processo_anexado_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + $objProtocoloAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); + $objProtocoloPrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + + // Cadastra documento Externo ao processo anexado + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Anexa processo ao processo principal + $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Cadastra documento Externo ao processo principal + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste6, $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']); - // Incluir novos documentos relacionados no processo anexado - $this->abrirProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); - $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->anexarProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste6); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -205,4 +214,13 @@ public function test_verificar_devolucao_destino_processo_anexado() $this->validarDadosDocumento($listaDocumentosProcessoAnexado[1], self::$documentoTeste4, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoAnexado[2], self::$documentoTeste5, self::$destinatario); } + + /** + * @inheritDoc + */ + public static function tearDownAfterClass(): void + { + putenv("DATABASE_HOST=org1-database"); + parent::tearDownAfterClass(); + } } diff --git a/tests_sei41/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php b/tests_sei41/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php index 460e9f7bf..82489e1e6 100755 --- a/tests_sei41/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php @@ -15,7 +15,7 @@ * Execution Groups * @group execute_alone_group2 */ -class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucoesEAnexacoesTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -31,6 +31,11 @@ class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase public static $documentoTeste8; public static $protocoloTestePrincipal; public static $protocoloTesteAnexado; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTesteAnexadoDTO; + + + /** * Teste inicial de trâmite de processo apartado para o órgão B @@ -53,7 +58,7 @@ public function test_tramitar_processo_simples_para_orgaoB() self::$documentoTeste2 = $this->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"]; } @@ -89,13 +94,16 @@ public function test_devolucao_processo_simples_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + + putenv("DATABASE_HOST=org1-database"); } @@ -137,20 +145,23 @@ public function test_tramitar_processo_anexado_para_orgaoB() self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = $objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); - // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + $objProtocoloTesteAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); + $this->anexarProcessoFixture($objProtocoloTestePrincipalDTO->getDblIdProtocolo(), $objProtocoloTesteAnexadoDTO->getDblIdProtocolo()); + + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // 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( self::$protocoloTestePrincipal, @@ -260,6 +271,7 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste7 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); @@ -268,11 +280,16 @@ public function test_devolucao_processo_para_origem() // Acessar sistema do this->REMETENTE do processo $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // Consulta no Org2/B o DTO do Protocolo Principal + $objProtocoloTestePrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + // Incluir novos documentos relacionados + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste7, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste8, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); + $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste7); - $this->cadastrarDocumentoInterno(self::$documentoTeste8); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( @@ -364,4 +381,13 @@ public function test_verificar_devolucao_destino_processo_anexado() $this->validarDadosDocumento($listaDocumentosProcessoAnexado[2], self::$documentoTeste3, self::$destinatario); $this->validarDadosDocumento($listaDocumentosProcessoAnexado[3], self::$documentoTeste4, self::$destinatario); } + + /** + * @inheritDoc + */ + public static function tearDownAfterClass(): void + { + putenv("DATABASE_HOST=org1-database"); + parent::tearDownAfterClass(); + } } diff --git a/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php index a64884498..9286d0e03 100755 --- a/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php +++ b/tests_super/funcional/tests/FixtureCenarioBaseTestCase.php @@ -5,6 +5,7 @@ use Tests\Funcional\Sei\Fixtures\{ProtocoloFixture,ProcedimentoFixture,AtividadeFixture,ContatoFixture}; use Tests\Funcional\Sei\Fixtures\{ParticipanteFixture,RelProtocoloAssuntoFixture,AtributoAndamentoFixture}; use Tests\Funcional\Sei\Fixtures\{DocumentoFixture,AssinaturaFixture,AnexoFixture,AnexoProcessoFixture}; +use Tests\Funcional\Sei\Fixtures\{HipoteseLegalFixture}; use function PHPSTORM_META\map; /** @@ -14,9 +15,21 @@ class FixtureCenarioBaseTestCase extends CenarioBaseTestCase { protected function cadastrarProcessoFixture(&$dadosProcesso) { + + if (!is_null($dadosProcesso['HIPOTESE_LEGAL'])){ + $param = [ + 'Nome' => trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[0]), + 'BaseLegal' => explode(')',trim(explode('(',$dadosProcesso['HIPOTESE_LEGAL'])[1]))[0] + ]; + $objHipLegalFixture = new HipoteseLegalFixture(); + $objHipLegalDTO = $objHipLegalFixture->buscar($param)[0]; + } + $parametros = [ 'Descricao' => $dadosProcesso['DESCRICAO'] ?: util::random_string(20), 'Interessados' => $dadosProcesso['INTERESSADOS'] ?: util::random_string(40), + 'IdHipoteseLegal' => $dadosProcesso['HIPOTESE_LEGAL'] ? $objHipLegalDTO->getNumIdHipoteseLegal() : null, + 'StaNivelAcessoLocal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO, 'StaNivelAcessoGlobal' => $dadosProcesso["RESTRICAO"] ?: PaginaIniciarProcesso::STA_NIVEL_ACESSO_PUBLICO ]; $objProtocoloFixture = new ProtocoloFixture(); @@ -160,7 +173,6 @@ protected function realizarTramiteExternoFixture(&$processoTeste, $documentosTes // 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()); diff --git a/tests_super/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php b/tests_super/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php index 0256ba747..d7b7e2598 100755 --- a/tests_super/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoRestritoHipotesePadraoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoHipotesePadraoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoHipotesePadraoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -35,17 +35,18 @@ public function test_tramitar_processo_restrito_hipotese_nao_mapeada() self::$processoTeste["RESTRICAO"] = PaginaIniciarProcesso::STA_NIVEL_ACESSO_RESTRITO; self::$processoTeste["HIPOTESE_LEGAL"] = self::$remetente["HIPOTESE_RESTRICAO_NAO_MAPEADO"]; - // 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 - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); + + // Acessar sistema do this->REMETENTE do processo + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_super/funcional/tests/TramiteProcessoRestritoTest.php b/tests_super/funcional/tests/TramiteProcessoRestritoTest.php index ca494deb4..24687cd65 100755 --- a/tests_super/funcional/tests/TramiteProcessoRestritoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoRestritoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoRestritoTest extends CenarioBaseTestCase +class TramiteProcessoRestritoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -40,13 +40,14 @@ public function test_tramitar_processo_restrito() $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); // Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); - // Incluir Documentos no Processo - $this->cadastrarDocumentoInterno(self::$documentoTeste); + // Incluir e assinar documento no processo + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); - // Assinar documento interno criado anteriormente - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + // Abrir processo + $this->abrirProcesso(self::$protocoloTeste); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_super/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php b/tests_super/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php index b6427d848..14000e503 100755 --- a/tests_super/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php +++ b/tests_super/funcional/tests/TramiteProcessoTamanhoAcimaLimiteDestinoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_alone_group3 */ -class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends CenarioBaseTestCase +class TramiteProcessoTamanhoAcimaLimiteDestinoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -53,10 +53,17 @@ public function test_tramitar_processo_tamanho_acima_limite_destino() self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_003.pdf'); + + // Cadastrar novo processo de teste + $objProtocoloDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloDTO->getStrProtocoloFormatado(); + + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste, $objProtocoloDTO->getDblIdProtocolo()); $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); - $this->cadastrarDocumentoExterno(self::$documentoTeste); + + $this->abrirProcesso(self::$protocoloTeste); + $this->tramitarProcessoExternamente( self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); diff --git a/tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php b/tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php similarity index 81% rename from tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php rename to tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php index 2c558cfa8..2a38b86be 100755 --- a/tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPai.php +++ b/tests_super/funcional/tests/TramiteProcessoUnidadeSemHierarquiaPaiTest.php @@ -1,6 +1,6 @@ gerarDadosDocumentoInternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1); - $this->realizarTramiteExternoSemvalidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario); self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; $paginaProcesso = new PaginaProcesso($this); diff --git a/tests_super/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php b/tests_super/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php index b5362de4a..acca4c887 100755 --- a/tests_super/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php +++ b/tests_super/funcional/tests/TramiteProcessosComDevolucaoAmbosAnexadosTest.php @@ -6,7 +6,7 @@ * Execution Groups * @group execute_alone_group6 */ -class TramiteProcessosComDevolucaoAmbosAnexadosTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucaoAmbosAnexadosTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -44,7 +44,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste1, self::$documentoTeste2); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTestePrincipal, $documentos, self::$remetente, self::$destinatario); self::$protocoloTestePrincipal = self::$processoTestePrincipal["PROTOCOLO"]; $this->sairSistema(); @@ -55,7 +55,7 @@ public function test_tramitar_processos_separados_da_origem() self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); self::$protocoloTesteAnexado = self::$processoTesteAnexado["PROTOCOLO"]; } @@ -96,21 +96,30 @@ public function test_devolucao_processo_anexado_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); + $objProtocoloAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); + $objProtocoloPrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + + // Cadastra documento Externo ao processo anexado + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Anexa processo ao processo principal + $this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo()); + + // Cadastra documento Externo ao processo principal + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste6, $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']); - // Incluir novos documentos relacionados no processo anexado - $this->abrirProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); - $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->anexarProcesso(self::$protocoloTesteAnexado); - $this->cadastrarDocumentoExterno(self::$documentoTeste6); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( diff --git a/tests_super/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php b/tests_super/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php index 460e9f7bf..14958b88a 100755 --- a/tests_super/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php +++ b/tests_super/funcional/tests/TramiteProcessosComDevolucoesEAnexacoesTest.php @@ -15,7 +15,7 @@ * Execution Groups * @group execute_alone_group2 */ -class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase +class TramiteProcessosComDevolucoesEAnexacoesTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -31,6 +31,11 @@ class TramiteProcessosComDevolucoesEAnexacoesTest extends CenarioBaseTestCase public static $documentoTeste8; public static $protocoloTestePrincipal; public static $protocoloTesteAnexado; + public static $objProtocoloTestePrincipalDTO; + public static $objProtocoloTesteAnexadoDTO; + + + /** * Teste inicial de trâmite de processo apartado para o órgão B @@ -53,7 +58,7 @@ public function test_tramitar_processo_simples_para_orgaoB() self::$documentoTeste2 = $this->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"]; } @@ -89,13 +94,16 @@ public function test_devolucao_processo_simples_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); $documentos = array(self::$documentoTeste3, self::$documentoTeste4); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTesteAnexado, $documentos, self::$remetente, self::$destinatario); + + putenv("DATABASE_HOST=org1-database"); } @@ -137,20 +145,23 @@ public function test_tramitar_processo_anexado_para_orgaoB() self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); self::$documentoTeste6 = $this->gerarDadosDocumentoInternoTeste(self::$remetente); - // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $objProtocoloTestePrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal); + self::$protocoloTestePrincipal = $objProtocoloTestePrincipalDTO->getStrProtocoloFormatado(); + + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); - // Cadastrar novo processo de teste principal e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste5); + $objProtocoloTesteAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO); // Realizar a anexação de processos - $this->anexarProcesso(self::$protocoloTesteAnexado); + $this->anexarProcessoFixture($objProtocoloTestePrincipalDTO->getDblIdProtocolo(), $objProtocoloTesteAnexadoDTO->getDblIdProtocolo()); - $this->cadastrarDocumentoInterno(self::$documentoTeste6); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste6, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + // 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( self::$protocoloTestePrincipal, @@ -260,6 +271,7 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste7 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); @@ -268,11 +280,16 @@ public function test_devolucao_processo_para_origem() // Acessar sistema do this->REMETENTE do processo $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + // Consulta no Org2/B o DTO do Protocolo Principal + $objProtocoloTestePrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO); + // Incluir novos documentos relacionados + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste7, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste8, $objProtocoloTestePrincipalDTO->getDblIdProtocolo()); + + putenv("DATABASE_HOST=org1-database"); + $this->abrirProcesso(self::$protocoloTestePrincipal); - $this->cadastrarDocumentoExterno(self::$documentoTeste7); - $this->cadastrarDocumentoInterno(self::$documentoTeste8); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente(