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

feat: Add assertResponseStatusCodeSame to StaticMethodCallsFixer #7947

Conversation

MarlonResler
Copy link

Add assertResponseStatusCodeSame to PhpUnitTestCaseStaticMethodCallsFixerTest.php.
Referencing Feature Request:
#7922

The change is already covered by test for this file imho.

@MarlonResler MarlonResler force-pushed the feature/assertResponseStatusCodeSame-to-StaticMethodCallsFixer branch from 9a5271e to ca32c76 Compare April 15, 2024 14:00
@MarlonResler MarlonResler changed the title Add assertResponseStatusCodeSame to StaticMethodCallsFixer feat: Add assertResponseStatusCodeSame to StaticMethodCallsFixer Apr 15, 2024
@coveralls
Copy link

coveralls commented Apr 15, 2024

Coverage Status

coverage: 96.013%. remained the same
when pulling ca32c76 on MarlonResler:feature/assertResponseStatusCodeSame-to-StaticMethodCallsFixer
into ce40b80 on PHP-CS-Fixer:master.

Copy link
Contributor

@kubawerlos kubawerlos left a comment

Choose a reason for hiding this comment

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

Referencing Feature Request: #7922

No, not really, that feature request mentions assertResponseStatusCodeSame as an example, there are more Symfony's assertions: https://symfony.com/doc/current/testing.html#response-assertions

The change is already covered by test for this file IMHO.

How is that? Change covered by a test is a change that when reverted that test would fail.

@Wirone
Copy link
Member

Wirone commented Apr 15, 2024

Hi @MarlonResler and thanks for your contribution! Unfortunately, as @kubawerlos already pointed out, this PR neither addresses #7922 (which is about flexible way for defining assertions that should be fixed, assertResponseStatusCodeSame is only an example), or is covered by tests (the STATIC_METHODS constant you extended is only referenced in testFixerContainsAllPhpunitStaticMethodsInItsList() which only verifies if we have all the assert methods on our list). In this form your PR does not follow our contribution guide, and can't be merged. Adding test for this one particular method also is not a way we should go, as this does not solve the root issue. Are you willing to implement full support for flexible list of assertion methods 🙂?

Side note: mentioned test that uses STATIC_METHODS is pretty weird, as TestCase differs between PHPUnit versions and list of assertions is not the same for them. Also, it checks if we have every assertion method on our list, but does not check if we have more than that, and as far as I see for example assertArraySubset was deprecated and removed, but it's still on our list. Should we clean this up, or should this list be historically filled with all assertions that were available? 🤔

@MarlonResler
Copy link
Author

Hi @Wirone,
I see I misinterpreted the test you mentioned in the class as a full test, just as I overlooked the example in the feature request I mentioned.
The change resulted from a local workaround that I didn't look at closely enough.
Since a customizable list of asserts was desired by the feature request and this makes sense in conjunction with other frameworks, I'll take a closer look at it the next days.

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