Skip to content

Commit

Permalink
tests: refatoracao testes funcionais (pengovbr#570)
Browse files Browse the repository at this point in the history
* tests: refatoracao testes funcionais

* chore: remover codigo comentado

* chore: remover codigo comentado
  • Loading branch information
marvdias authored and Glaydson Rodrigues committed Aug 28, 2024
1 parent bfe937a commit a1dc73f
Show file tree
Hide file tree
Showing 24 changed files with 250 additions and 510 deletions.
4 changes: 2 additions & 2 deletions tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function cadastrarProcessoFixture(&$dadosProcesso)
'IdAtividade' => $objAtividadeDTO->getNumIdAtividade()
]);

$dadosProcesso['PROTOCOLO'] = $protocoloGerado;
$dadosProcesso['PROTOCOLO'] = $objProtocoloDTO->getStrProtocoloFormatado();

return $objProtocoloDTO;
}
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_alone_group5
*/
class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoExternoMesmoOrgaoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -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"];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @group rodarseparado2
* @group execute_alone_group1
*/
class TramiteProcessoContendoDocumentoExternoParticionadoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoExternoParticionadoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -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'));
Expand Down Expand Up @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_parallel_group1
*/
class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoGeradoMesmoOrgaoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -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"];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_alone_group1
*/
class TramiteProcessoContendoDocumentoGeradoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoGeradoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_parallel_group1
*/
class TramiteProcessoContendoDocumentoInternoExternoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoInternoExternoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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);
}

Expand Down
Loading

0 comments on commit a1dc73f

Please sign in to comment.