Closed TavoNiievez closed 5 months ago
@cs278 @W0rma @xEdelweiss @ThomasLandauer
These assertions verify that the Symfony validator component is working correctly in the application, specifically with the test data defined in the test cases.
If you have some free time please review my PR :-) Thanks!
What about shortening the name a bit, from dontSeeViolatedConstraint
to just dontSeeViolation
?
And I think the "count" method should be plural: seeViolationsCount
Hi @ThomasLandauer
Indeed, I considered seeViolation
and seeViolated
but I think that when reading it is not explicit with what 'violation' I am referring to, so I wanted to avoid uncomfortable laughs or unintentional offenses in the developers who read this code.
For the moment, I agree that the "count" method should be plural, thank you very much for pointing that out.
IMO, "violation" is a common term in programming, so I guess it's politically correct :-) dontSeeViolatedConstraint
is OK too, it's just that the method names are getting longer and longer...
What do the others say?
If I think in terms of Symfony, validator constraints is a pretty commonly known naming, so I think my first guess reading dontSeeViolation
would also be that it's about violation constraints from the validator component.
But that naming might not be that clear for everybody and I think using the naming violation constraint might be more explicit and if in doubt I tend to rather use longer naming than being ambiguous.
In the end, I don't have a strong preference here, because in Codeception I intentionally have to enable the Symfony module, so I'm aware of the Symfony context.
FYI, Symfony itself also doesn't use 'constraint' in the method naming, but then again, in the Symfony context that might not be necessary: https://github.com/symfony/symfony/blob/7.0/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
Hi @TavoNiievez I am a little late, yet this is a great addition to the module!
I also like the shorter names, and the Symfony Serializer uses 'violations' as a key in normalization, so it should be easy to understand.
On the other hand, a longer name makes it easier to discover the method without looking at the docs. At least I try to "guess" the appropriate method first :) It's nice that you may find it by searching for either 'constraint' or 'violation'.
Examples: