Skip to content
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

Merged
merged 3 commits into from Jan 20, 2024
Merged

Conversation

keradus
Copy link
Member

@keradus keradus commented Jan 15, 2024

recovers #7610

@keradus keradus enabled auto-merge (squash) January 15, 2024 20:15
…ual usage can vary, but result sets must be identical
@coveralls
Copy link

coveralls commented Jan 15, 2024

Coverage Status

coverage: 94.755%. remained the same
when pulling d87e4b1 on keradus:7610_recover
into 0e2de60 on PHP-CS-Fixer:master.

Comment on lines +38 to +42
$this->actualDeprecations = array_unique($this->actualDeprecations);
sort($this->actualDeprecations);
$this->expectedDeprecations = array_unique($this->expectedDeprecations);
sort($this->expectedDeprecations);
self::assertSame($this->expectedDeprecations, $this->actualDeprecations);
Copy link
Member

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?

Copy link
Member Author

@keradus keradus Jan 19, 2024

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)

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@keradus
Copy link
Member Author

keradus commented Jan 20, 2024

thank you @kubawerlos

@keradus keradus merged commit 48a62f0 into PHP-CS-Fixer:master Jan 20, 2024
25 checks passed
danog pushed a commit to zoonru/PHP-CS-Fixer that referenced this pull request Feb 2, 2024
Co-authored-by: Kuba Werłos <9282069+kubawerlos@users.noreply.github.com>
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.

None yet

4 participants