Skip to content

Commit

Permalink
test: correção de testes funcionais
Browse files Browse the repository at this point in the history
  • Loading branch information
marvdias committed Sep 3, 2024
1 parent b56c70a commit 5e97a3b
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Tests\Funcional\Sei\Fixtures\ProtocoloFixture;

/**
* Testes de trâmite de um processo tendo a sua devolução através de sua anexação à outro processo
* criado no órgão de destino.
Expand Down Expand Up @@ -93,11 +91,7 @@ public function test_devolucao_processo_anexado_em_outro_para_origem()
self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

// Busca ID que Protocolo principal recebeu no org2
$parametros = [
'ProtocoloFormatado' => self::$protocoloTesteAnexado,
];
$objProtocoloFixture = new ProtocoloFixture();
$objProtocoloAnexadoDTO = $objProtocoloFixture->buscar($parametros)[0];
$objProtocoloAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO);
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloAnexadoDTO->getDblIdProtocolo());

// Gerar dados de testes para representar o processo principal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Tests\Funcional\Sei\Fixtures\ProtocoloFixture;

/**
* Teste de trâmite de um processo com devolução contendo novos documentos e com outro processo anexado
*
Expand Down Expand Up @@ -97,11 +95,7 @@ public function test_devolucao_processo_contendo_outro_anexado_para_origem()
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloAnexadoDTO->getDblIdProtocolo());

// Incluir novos documentos relacionados no processo anexado
$parametros = [
'ProtocoloFormatado' => self::$protocoloTestePrincipal,
];
$objProtocoloFixture = new ProtocoloFixture();
$objProtocoloPrincipalDTO = $objProtocoloFixture->buscar($parametros)[0];
$objProtocoloPrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO);

$this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TramiteRecebimentoDocumentoAvulsoTest extends FixtureCenarioBaseTestCase

/**
* Teste preparatório (setUp()). Definição de contextos e instanciação da api de integração
*
*
* @Depends CenarioBaseTestCase::setUpBeforeClass
*
* @return void
Expand All @@ -39,6 +39,7 @@ public function setUp(): void
// Carregar contexto de testes e dados sobre certificado digital
self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B);
self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A);
putenv("DATABASE_HOST=org2-database");

// Instanciar objeto de teste utilizando o BeSimpleSoap
$localCertificado = self::$remetente['LOCALIZACAO_CERTIFICADO_DIGITAL'];
Expand Down Expand Up @@ -87,6 +88,7 @@ public function test_devolucao_processo_para_origem()
self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste2, self::$documentoTeste3);
putenv("DATABASE_HOST=org1-database");
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}

Expand Down Expand Up @@ -125,8 +127,8 @@ public function test_devolucao_processo_para_origem_documento_avulso()
self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);
self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste4, self::$documentoTeste5);
putenv("DATABASE_HOST=org2-database");
$documentos = array(self::$documentoTeste4, self::$documentoTeste5);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}

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

Expand Down Expand Up @@ -84,30 +85,38 @@ public function test_devolucao_processo_anexado_em_outro_para_origem()
{
self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B);
self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A);
// Selecionar banco do org2 para fazer inserção dos documentos
putenv("DATABASE_HOST=org2-database");

self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

// Acessar sistema do this->REMETENTE do processo
$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);

// Incluir novos documentos relacionados no processo anexado
$this->abrirProcesso(self::$protocoloTesteAnexado);
$this->cadastrarDocumentoExterno(self::$documentoTeste3);
// Busca ID que Protocolo principal recebeu no org2
$objProtocoloAnexadoDTO = $this->consultarProcessoFixture(self::$protocoloTesteAnexado, \ProtocoloRN::$TP_PROCEDIMENTO);
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloAnexadoDTO->getDblIdProtocolo());

// Gerar dados de testes para representar o processo principal
self::$processoTestePrincipal = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);
self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

// Cadastra processo principal, seus documentos e anexa processo recebido anteriormente
self::$protocoloTestePrincipal = $this->cadastrarProcesso(self::$processoTestePrincipal);
$this->cadastrarDocumentoInterno(self::$documentoTeste4);
$this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']);
$objProtocoloPrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTestePrincipal);
self::$protocoloTestePrincipal = $objProtocoloPrincipalDTO->getStrProtocoloFormatado();

// Cadastra e assina
$this->cadastrarDocumentoInternoFixture(self::$documentoTeste4,$objProtocoloPrincipalDTO->getDblIdProtocolo());

$this->anexarProcesso(self::$protocoloTesteAnexado);
$this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo());

$this->cadastrarDocumentoExterno(self::$documentoTeste5);
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloPrincipalDTO->getDblIdProtocolo());

putenv("DATABASE_HOST=org1-database");

// Acessar sistema do this->REMETENTE do processo
$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);

// Abre processo principal para tramitar
$this->abrirProcesso(self::$protocoloTestePrincipal);

// Trâmitar Externamento processo para órgão/unidade destinatária
$this->tramitarProcessoExternamente(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Execution Groups
* @group execute_alone_group5
*/
class TramiteProcessoComDevolucaoContendoOutroAnexadoTest extends CenarioBaseTestCase
class TramiteProcessoComDevolucaoContendoOutroAnexadoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -45,7 +45,7 @@ public function test_tramitar_processo_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"];
}

Expand Down Expand Up @@ -81,28 +81,31 @@ public function test_devolucao_processo_contendo_outro_anexado_para_origem()
{
self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B);
self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A);

// Acessar sistema do this->REMETENTE do processo
$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);
putenv("DATABASE_HOST=org2-database");

// Gerar dados de testes para representar o processo principal
self::$processoTesteAnexado = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);
self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

// Cadastra processo anexado, seus documentos e anexar ao processo principal recebido anteriormente
self::$protocoloTesteAnexado = $this->cadastrarProcesso(self::$processoTesteAnexado);
$this->cadastrarDocumentoInterno(self::$documentoTeste4);
$this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']);
$this->cadastrarDocumentoExterno(self::$documentoTeste5);
$objProtocoloAnexadoDTO = $this->cadastrarProcessoFixture(self::$processoTesteAnexado);
self::$protocoloTesteAnexado = $objProtocoloAnexadoDTO->getStrProtocoloFormatado();
$this->cadastrarDocumentoInternoFixture(self::$documentoTeste4, $objProtocoloAnexadoDTO->getDblIdProtocolo());
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste5, $objProtocoloAnexadoDTO->getDblIdProtocolo());

// Incluir novos documentos relacionados no processo anexado
$this->abrirProcesso(self::$protocoloTestePrincipal);
$this->anexarProcesso(self::$protocoloTesteAnexado);
$objProtocoloPrincipalDTO = $this->consultarProcessoFixture(self::$protocoloTestePrincipal, \ProtocoloRN::$TP_PROCEDIMENTO);

$this->anexarProcessoFixture($objProtocoloPrincipalDTO->getDblIdProtocolo(), $objProtocoloAnexadoDTO->getDblIdProtocolo());

self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);
$this->cadastrarDocumentoExterno(self::$documentoTeste3);
$this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloPrincipalDTO->getDblIdProtocolo());

$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,
self::$destinatario['REP_ESTRUTURAS'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TramiteRecebimentoDocumentoAvulsoTest extends FixtureCenarioBaseTestCase

/**
* Teste preparatório (setUp()). Definição de contextos e instanciação da api de integração
*
*
* @Depends CenarioBaseTestCase::setUpBeforeClass
*
* @return void
Expand All @@ -39,6 +39,7 @@ public function setUp(): void
// Carregar contexto de testes e dados sobre certificado digital
self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B);
self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A);
putenv("DATABASE_HOST=org2-database");

// Instanciar objeto de teste utilizando o BeSimpleSoap
$localCertificado = self::$remetente['LOCALIZACAO_CERTIFICADO_DIGITAL'];
Expand Down Expand Up @@ -87,6 +88,7 @@ public function test_devolucao_processo_para_origem()
self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste2, self::$documentoTeste3);
putenv("DATABASE_HOST=org1-database");
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}

Expand Down Expand Up @@ -125,8 +127,8 @@ public function test_devolucao_processo_para_origem_documento_avulso()
self::$documentoTeste4 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);
self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste4, self::$documentoTeste5);
putenv("DATABASE_HOST=org2-database");
$documentos = array(self::$documentoTeste4, self::$documentoTeste5);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Tests\Funcional\Sei\Fixtures\ProtocoloFixture;

/**
* Testes de trâmite de um processo tendo a sua devolução através de sua anexação à outro processo
* criado no órgão de destino.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Tests\Funcional\Sei\Fixtures\ProtocoloFixture;

/**
* Teste de trâmite de um processo com devolução contendo novos documentos e com outro processo anexado
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public function test_devolucao_processo_para_origem_documento_avulso()
self::$documentoTeste5 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

putenv("DATABASE_HOST=org2-database");
$documentos = array(self::$documentoTeste4, self::$documentoTeste5);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}

Expand Down

0 comments on commit 5e97a3b

Please sign in to comment.