Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/phpunit #28

Merged
merged 12 commits into from
Jul 16, 2024
Merged

Feature/phpunit #28

merged 12 commits into from
Jul 16, 2024

Conversation

lpirola
Copy link
Collaborator

@lpirola lpirola commented May 23, 2024

Descrição

Adicionar capacidade de testar de forma unitária o código php

Validação

Disparar gatilho de pipeline

Issues relacionadas

@lpirola lpirola force-pushed the feature/phpunit branch 5 times, most recently from 59a13e0 to b98f3f8 Compare May 23, 2024 03:52
@lpirola lpirola requested a review from vicmagpac May 23, 2024 10:50
@lpirola lpirola changed the base branch from main to develop July 2, 2024 12:37
@lpirola lpirola force-pushed the feature/phpunit branch 5 times, most recently from 391db43 to 01a2204 Compare July 2, 2024 13:09
@lpirola lpirola force-pushed the feature/phpunit branch 3 times, most recently from f2616c3 to 09f9787 Compare July 2, 2024 14:10
name: Testing

on:
pull_request:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpirola analisando especificamente o momento de executar os testes fico pensando se faz sentido executar em todos os commits, dessa forma conseguimos identificar o problema de forma mais rápida. Vou mandar aqui alguns pontos positivos e negativos baseado das duas abordagens:

  1. Execução dos Testes em Cada Commit

Vantagens:

  • Detecta erros e regressões rapidamente, proporcionando feedback imediato ao desenvolvedor.
  • Garante que o código na branch esteja sempre em um estado funcional.

Desvantagens:

  • Pode ser demorado se o conjunto de testes for grande, afetando a produtividade.
  • Pode ser excessivo em projetos menores ou com commits muito frequentes.
  1. Execução dos Testes no Merge Request (Pull Request) para a develop

Vantagens:

  • Permite revisão de código com confiança de que as alterações não quebram funcionalidades existentes.
  • Centraliza a validação do código em momentos cruciais, como a integração de novas funcionalidades.

Desvantagens:

  • O feedback não é tão imediato quanto nos commits.
  • Problemas podem ser detectados tardiamente, após várias alterações já terem sido feitas.

Para adicionar em todos os commits podemos usar:

on: 
  push:
    # only trigger on branches, not on tags
    branches: '**'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feito!

@@ -80,7 +80,7 @@ protected function _requireAuthentication() {
if($app->request->isAjax() || $app->request->getHeaderLine('Content-Type') === 'application/json'){
$app->view->controller->errorJson(\MapasCulturais\i::__('Esta ação requer autenticação'), 401);
}else{
$app->redirect($app->controller('auth')->createUrl(''), 302);
$app->redirect($app->controller('auth')->createUrl(''), 401);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpirola uma possibilidade também seria usar a própria contante da classe Response do Http Foundation do symfony.

Exemplo de uso:

use Symfony\Component\HttpFoundation\Response;

$app->redirect($app->controller('auth')->createUrl(''), Response::HTTP_UNAUTHORIZED);

Mais detalhes podem ser acessados aqui: https://symfony.com/doc/current/components/http_foundation.html#response

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferi manter assim para não misturar os frameworks. Podemos refletir melhor sobre se vamos incluir o Symfony na pasta do Slim.

@vicmagpac vicmagpac self-requested a review July 11, 2024 17:57
@lpirola lpirola merged commit c79eadd into develop Jul 16, 2024
1 check failed
@lpirola lpirola deleted the feature/phpunit branch September 5, 2024 17:42
lpirola pushed a commit that referenced this pull request Oct 8, 2024
Atualiza instituições disponíveis para campo de dados bancários
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants