Skip to content

Adjust all type-specific/rule-dedicated methods to check only their own validation rule - #40

Open
Neluxx wants to merge 15 commits into
cakephp-5.xfrom
38-check-only-own-validation-rule
Open

Adjust all type-specific/rule-dedicated methods to check only their own validation rule#40
Neluxx wants to merge 15 commits into
cakephp-5.xfrom
38-check-only-own-validation-rule

Conversation

@Neluxx

@Neluxx Neluxx commented Aug 26, 2026

Copy link
Copy Markdown
Member

Closes #38

@Neluxx
Neluxx requested a review from ravage84 August 26, 2026 09:39
@Neluxx Neluxx self-assigned this Aug 26, 2026

@ravage84 ravage84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this will be a big step forward! 🙏

Comment thread src/Traits/DataValidationTestTrait.php Outdated
Comment thread docs/Usage.md
Comment thread docs/Usage.md Outdated
Comment thread tests/TestApp/Model/Table/ValidationTestTable.php
Comment thread tests/TestCase/Traits/DataValidationTestTraitTest.php Outdated
*/
public function testTypeSpecificMethodIgnoresUnrelatedErrors(): void
{
$field = 'multi_rule_field';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we test all methods that now ignore other rules against this field, too? 🤔

That in turn would (almost) double the amount of fields because for each {rule}_field we would also need a field that has this rule and at least one other...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The "ignore unrelated errors" logic lives in the shared testDataValidationContains / testDataValidationNotContains helpers, so testDataValidationInteger is enough to prove the wiring. Testing every method would just re-exercise the same path and double the fixtures for little gain. Happy to add full coverage if you'd prefer.

Comment thread tests/TestCase/Traits/DataValidationTestTraitTest.php Outdated
Comment thread tests/TestCase/Traits/DataValidationTestTraitTest.php Outdated
Comment thread tests/TestCase/Traits/DataValidationTestTraitTest.php Outdated
Comment thread CHANGELOG.md Outdated
@Neluxx
Neluxx requested a review from ravage84 August 27, 2026 13:03
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.

Adjust all type-specific/rule-dedicated methods to check only their own validation rule

3 participants