Correção da Validação da Faixa Etária na Série (Issue #1095)#1107
Open
Edilson-r-jr wants to merge 5 commits intoportabilis:2.10from
Open
Correção da Validação da Faixa Etária na Série (Issue #1095)#1107Edilson-r-jr wants to merge 5 commits intoportabilis:2.10from
Edilson-r-jr wants to merge 5 commits intoportabilis:2.10from
Conversation
…ation and update test cases
… and add unit tests
|
edersoares
reviewed
Nov 24, 2025
|
|
||
| class GradeAgeGroupValidator | ||
| { | ||
| public static function faixaEtariaEhValida($idadeInicial, $idadeIdeal, $idadeFinal): bool |
Member
There was a problem hiding this comment.
Pode escrever o código apenas em inglês. Estamos procurando evitar o português nos novos métodos.
|
|
||
| foreach ($idades as $idade) { | ||
| if ($idade !== null && $idade !== '' && $idade < 0) { | ||
| return false; |
Member
There was a problem hiding this comment.
Esses campos são opcionais e não necessariamente serão utilizados. Neste caso você está adicionando um bloqueio indevido ao cadastro de série. A validação tem que ser condicional ao uso do campo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



#1095
DESCRIÇÃO
Este Pull Request implementa a correção da Issue #1095, que relatava que os campos de faixa etária no cadastro/edição de Série (
idade_inicial,idade_final,idade_ideal) permitiam valores negativos, resultando em dados inconsistentes no sistema.Para resolver isso, foram implementadas as seguintes melhorias:
Criação do validador
GradeAgeGroupValidator, responsável por garantir que os valores de idade sejam maiores ou iguais a zero.Integração desse validador nos métodos Novo() e Editar() do arquivo
educar_serie_cad.php, impedindo o salvamento quando idades negativas forem informadas.Exibição da mensagem clara ao usuário:
"Os campos de idade devem ser maiores ou iguais a zero."
Adição de testes unitários seguindo o ciclo TDD, cobrindo os seguintes cenários:
Com isso, o sistema passa a impedir o cadastro e a edição de séries com faixas etárias inválidas, garantindo maior consistência dos dados e prevenindo erros em matrículas, validações e relatórios.
AMBIENTE
Este Pull Request foi desenvolvido e testado no seguinte ambiente: