-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DX: check deprecations exactly #7742
Conversation
…ual usage can vary, but result sets must be identical
$this->actualDeprecations = array_unique($this->actualDeprecations); | ||
sort($this->actualDeprecations); | ||
$this->expectedDeprecations = array_unique($this->expectedDeprecations); | ||
sort($this->expectedDeprecations); | ||
self::assertSame($this->expectedDeprecations, $this->actualDeprecations); |
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.
My question still stands. After this change tests' result is conditioned by implementation. Let's say Foo::bar()
triggers deprecation, if our logic uses this, then we expect the deprecation in tests. Why would we need to modify expectation in test when that method is used again in the tested logic? Does the fact that deprecated method is used multiple times change anything?
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.
we care which deprecations were triggered (to ensure we do not rely on logic that was deprecated, without our explicit agreement to it), not how many times nor in which order
(thus, we have array_uniq
and sort
)
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.
Hmmmm, probably I overlooked array_unique()
🤔. So how is this different from what we have currently? I believe with the previous loop it also was checking if all expected deprecations were caught, so do we want to check if there were more expectations than actual deprecations, or other way around?
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.
current master is checking if all deprecations listed in expectDeprecation
happen, but not checking if any more happen on top. This PR makes sure we check both.
When using Sf brigde, we checked for both.
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.
ie master is not failing without https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7742/files#diff-80e18dd53b2dd28618278f183c30a01bc63e8aceec7508ab815ed2f124aa8f3dR58 , but this PR is.
thank you @kubawerlos |
Co-authored-by: Kuba Werłos <9282069+kubawerlos@users.noreply.github.com>
recovers #7610