-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Nomalize PHP unit test case method calls #20679
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
Nomalize PHP unit test case method calls #20679
Conversation
Hi @MathiasReker. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
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 preferable according to PHPUnit author, thanks for choosing this variant.
@MathiasReker could you please provide an automated way to apply such changes? I suppose php-cs-fixer
or something was used. Also, to avoid code base inconsistency a static test similar to running phpcs
should be implemented.
All my PR's are made from a custom shell script I wrote. I use different libraries and a lot of custom code. |
@MathiasReker I see, thanks for quick response. We cannot process PRs with hundreds of changed files without an automated way to reproduce your changeset. Also, as few custom code as possible must be used, or at least such changes should be separated from ones obtained using well-known tools. Here is more details on static test which needs to be implemented: #19311 (comment) So basically we want such code issues nevermore appear in codebase. |
Try to run this with php-cs-fixer: |
@MathiasReker great, yeah, I supposed something like that exists in So let's start from static test running |
I understand your point and I agree that it is the best way to do it. I can help you, but I can't work for free to that point. I don't use Magento, I just came by and though I could do a great work by letting my computer run a script overnight. :-) |
@MathiasReker I see. Unfortunately applying code changes is not the only part of work, they should be also reviewed by somebody and enforced with some automated test to avoid regressions. There were attempts before to apply |
@MathiasReker I closed PRs which seemed to be produced by |
Hi @MathiasReker, thank you for your contribution! |
Calls to PHPUnit\Framework\TestCase static methods must all be of the same type, either $this->, self:: or static::.