https://github.com/matomo-org/matomo/pull/17435 - Mouve

Site d'origine

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

Add new validator class - alpha numeric spaces #17435

Closed
wants to merge 3 commits into from

Conversation

@flamisz
Copy link
Contributor

@flamisz flamisz commented Apr 8, 2021

Description:

This new class will check if the validated field only contains alphanumeric characters and spaces. No special characters allowed.

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed
@diosmosis
Copy link
Member

@diosmosis diosmosis commented Apr 8, 2021

I think we have unit tests for existing validators so we'd want to add one for this.

$this->validate('onlyalpha');
$this->validate(123);
$this->validate('abc 123');
$this->validate('abc 123 and 0');

This comment has been minimized.

@sgiehl

sgiehl Apr 8, 2021
Member

might be good to also test edge cases like German umlauts, some Chinese characters and maybe even some utf8 emojis maybe

This comment has been minimized.

@flamisz

flamisz Apr 8, 2021
Author Contributor

definitely, I will do that 👍

This comment has been minimized.

@flamisz

flamisz Apr 8, 2021
Author Contributor

I added more test cases with special characters. Emoji is not supported with this regex. Do you think we should let emojis as well?

$this->validate('abc 123');
$this->validate('ABC 123 and 0');

$this->assertTrue(true);

This comment has been minimized.

@sgiehl

sgiehl Apr 9, 2021
Member

might be better to use $this->expectNotToPerformAssertions(); instead of doing an assert that can't fail.

Also you could also use one test for all strings with a dataprovider, like for the failing ones.

@flamisz flamisz marked this pull request as draft Apr 12, 2021
@flamisz
Copy link
Contributor Author

@flamisz flamisz commented Apr 27, 2021

I close this now as we don't need it.

@flamisz flamisz closed this Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants

level de log mis à 1

Récupération du document https://github.com/matomo-org/matomo/pull/17435.

Récupération de l'URL https://github.com/matomo-org/matomo/pull/17435...

Raccourcis

Commandes

Fermer