[Validator] Simplified testing of violations

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I simplified the assertion of violations in preparation of a replacement PR for #7276.
I think this should be renamed actually, as it is not asserting anymore, but building an assertion. PHPUnit methods building an assertion don't start with ``assert``