-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Move Constraint validator test case to Test namespace #17203
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
Conversation
$this->constraint, | ||
$this->cause | ||
); | ||
trigger_error('The '.__NAMESPACE__.'/AbstractConstraintValidatorTest is deprecated since version 3.1 and will be removed in 3.0. Use Symfony\Component\Validator\Test\ConstraintValidatorTestCase instead.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing silencing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and it cannot be removed in 3.0...
30ea9a3
to
cbf1f77
Compare
Thanks for your quick review, @stof! I've fixed the PR now. |
We do not maintain BC for test files in |
I agree with @Tobion, no need to preserve BC for tests |
Well, given that some tests are using this class in other components, we would have to preserve BC (and people might use it elsewhere too already). The point is that this base testcase is meant to be extended when writing tests. We just messed up its location when introducing it (and this is the drawback of the inclusion of tests inside the runtime, as our testsuite is autoloadable by any code installing the component as a dependency) |
@@ -28,7 +28,7 @@ | |||
"symfony/property-info": "~2.8|3.0", | |||
"symfony/security": "~2.8|~3.0", | |||
"symfony/expression-language": "~2.8|~3.0", | |||
"symfony/validator": "~2.8|~3.0", | |||
"symfony/validator": "~3.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an issue: we won't test the bridge with symfony/validator anymore, which could hide BC breaks.
We need to find a way to keep ~2.8 here.
(same comment for the other cases below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't this test the bridge with symfony/validator anymore? It would simply be tested against 3.1, or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @nicolas-grekas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas Can you give us more insights about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the point is that the test suite tests both against the highest and lowest possible dependencies. Since 3.1 is the minimum boundary, even the --prefer-lowest
tests will run against 3.1 and not against 2.8, which might hide compatibility issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the solution would be to keep both classes (new and old) and use the old one in the core libraries, so we can still properly support and test 2.8 and 3.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be good, yes.
@stof, then I suggest to NOT deprecate anything in this PR |
@nicolas-grekas I don't understand what you mean. Do you suggest moving the class without deprecating the old class name ? |
@stof yes, that's the best idea I have for now to still allow ~2.8 in composer json files... |
I think we are going too far with BC. Files under |
cbf1f77
to
5c516d8
Compare
Alright, removed the class and file. |
@nicolas-grekas The only remaining issue is the composer deps changes |
5c516d8
to
5eeb754
Compare
Rebased Status: Needs review |
@@ -1,6 +1,7 @@ | |||
UPGRADE FROM 3.0 to 3.1 | |||
======================= | |||
|
|||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflict resolution issue
5eeb754
to
d4ff6ff
Compare
Thanks, fixed your comments @stof. |
This seems to need a rebase again. |
// ... | ||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; | ||
|
||
class MyCustomValidatorTest extends ConstraintValidatorTestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we move away from prefixing abstract classes with Abstract
(in general)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not sure actually. But it seems to be more common to not add the prefix for abstract classes in Symfony.
@wouterj IIUC, it would be better to keep |
d4ff6ff
to
ed33a2d
Compare
Updated the PR to keep both classes and deprecate the old one. We can't trigger a deprecation warning, as we can't update all core packages to use the new class. |
ed33a2d
to
0e868ee
Compare
0e868ee
to
e938361
Compare
Thank you @wouterj. |
…(WouterJ) This PR was merged into the 3.2-dev branch. Discussion ---------- Move Constraint validator test case to Test namespace | Q | A | ------------- | --- | Bug fix? | no | New feature? | kinda | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - The Validator component has a very usefull test utility to test constraint validators. It's only hidden deep in the Tests namespace. Just as was done with the TypeTestCase of the Form component some years ago, I think it's usefull to move the constraint test case to the Test namespace as well. *Btw, my last PR of the year and the first deprecation of 3.1* 🎆 Commits ------- e938361 Move Constraint validator test case to Test namespace
The Validator component has a very usefull test utility to test constraint validators. It's only hidden deep in the Tests namespace. Just as was done with the TypeTestCase of the Form component some years ago, I think it's usefull to move the constraint test case to the Test namespace as well.
Btw, my last PR of the year and the first deprecation of 3.1 🎆