-
Notifications
You must be signed in to change notification settings - Fork 11
Add various fixers for PHPUnit tests #16
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
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.
Is this one really necessary? I guess you are adding this because of older version of PHPUnit.. but since it is deprecated and there is more than this what should be fixed before upgrading to new PHPUnit version, I see this redundant.
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.
What was deprecated and later removed in PHPUnit 6.0 was expectException(). The annotation is still supported (and not deprecated by PHPUnit) - https://github.com/sebastianbergmann/phpunit/blob/master/src/Util/Test.php#L353
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.
@MortalFlesh What do you mean by "there is more than this what should be fixed before upgrading to new PHPUnit version"?
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.
@TomasVotruba well I dont remember exactly, but for example namespaces of TestCase and of Mocks..
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.
@MortalFlesh Mocks are handled by the other fixer, and namespaced PHPUnit could be done using php_unit_namespaced fix pro php-cs-fixer or via Rector :)). But I don't think we need to enforce it here, right?
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 see. So "add other PHPUnit fixers as well, not just these"?
TomasVotruba
commented
May 4, 2018
What need to be done here?
@TomasVotruba I was off for two weeks, so I just need to get back to it :).
96c746f to
72b75bb
Compare
TomasVotruba
commented
May 5, 2018
👍
Btw, for more PHUnit polishments check out phpunit sets at @Rector
@carusogabriel took I really great job in covering them
@TomasVotruba Nice, will do :). But what exactly do you mean 🤔? https://github.com/rectorphp/rector/blob/master/easy-coding-standard.yml
TomasVotruba
commented
May 5, 2018
It's purely Rector, not coding standard.
https://github.com/rectorphp/rector/blob/master/config/level/phpunit/phpunit-specific-method.yml
PhpUnitMockFixer: Ensure dedicated helper methodscreateMock()andcreatePartialMock()are used where possible instead of->getMock().PhpUnitNoExpectationAnnotationFixer: UsesetExpectedException()instead of@expectedExceptionannotation (see https://thephp.cc/news/2016/02/questioning-phpunit-best-practices)PhpUnitSetUpTearDownVisibilityFixer: Visibility ofsetUp()andtearDown()method should be kept protected as defined in PHPUnit TestCase.