Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Strict and opinionated rules for PHPUnit #5

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

Merged
ondrejmirtes merged 6 commits into phpstan:master from mhujer:mh-strict-rules
Dec 27, 2017

Conversation

@mhujer
Copy link
Contributor

@mhujer mhujer commented Dec 21, 2017

I've created several rules that suggest better assertions in PHPUnit tests.

I have a few more in the backlog, but I wanted to start small to see if we are on the same page (and the PR is already tooo long anyway).

I've tested the Rules on @driveto codebase and on PHPStan itself, but it would be great if you can try it on something bigger (such as @slevomat codebase ;-))

tomasfejfar and lookyman reacted with thumbs up emoji
Copy link
Member

This is perfect! 😊 I will be able to test it on Slevomat once we upgrade to 0.9.

@ondrejmirtes ondrejmirtes merged commit 669990e into phpstan:master Dec 27, 2017
@mhujer mhujer deleted the mh-strict-rules branch December 27, 2017 14:35
Copy link
Member

ondrejmirtes commented Dec 28, 2017 via email

Btw what about assertInstanceof + the negative variant? That could also be enforced 😊
On 2017年12月21日 at 17:48, Martin Hujer ***@***.***> wrote: I've created several rules that suggest better assertions in PHPUnit tests. I have a few more in the backlog, but I wanted to start small to see if we are on the same page (and the PR is already tooo long anyway). I've tested the Rules on @driveto <https://github.com/driveto> codebase and on PHPStan itself, but it would be great if you can try it on something bigger (such as @slevomat <https://github.com/slevomat> codebase ;-)) ------------------------------ You can view, comment on, or merge this pull request online at: #5 Commit Summary - improve AssertSameDifferentTypesRule test coverage - Move PHPCS exclusion pattern to phpcs.xml - extract PHPUnit method call detection to helper - AssertSameNullExpectedRule - AssertSameBooleanExpectedRule - AssertSameWithCountRule File Changes - *M* README.md <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-0> (13) - *M* build.xml <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-1> (2) - *M* phpcs.xml <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-2> (1) - *A* src/Rules/PHPUnit/AssertRuleHelper.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-3> (52) - *A* src/Rules/PHPUnit/AssertSameBooleanExpectedRule.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-4> (53) - *M* src/Rules/PHPUnit/AssertSameDifferentTypesRule.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-5> (29) - *A* src/Rules/PHPUnit/AssertSameNullExpectedRule.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-6> (46) - *A* src/Rules/PHPUnit/AssertSameWithCountRule.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-7> (49) - *A* strictRules.neon <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-8> (13) - *A* tests/Rules/PHPUnit/AssertSameBooleanExpectedRuleTest.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-9> (37) - *M* tests/Rules/PHPUnit/AssertSameDifferentTypesRuleTest.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-10> (14) - *A* tests/Rules/PHPUnit/AssertSameNullExpectedRuleTest.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-11> (29) - *A* tests/Rules/PHPUnit/AssertSameWithCountRuleTest.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-12> (25) - *A* tests/Rules/PHPUnit/data/Foo.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-13> (13) - *A* tests/Rules/PHPUnit/data/assert-same-boolean-expected.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-14> (24) - *A* tests/Rules/PHPUnit/data/assert-same-count.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-15> (18) - *A* tests/Rules/PHPUnit/data/assert-same-null-expected.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-16> (22) - *M* tests/Rules/PHPUnit/data/assert-same.php <https://github.com/phpstan/phpstan-phpunit/pull/5/files#diff-17> (17) Patch Links: - https://github.com/phpstan/phpstan-phpunit/pull/5.patch - https://github.com/phpstan/phpstan-phpunit/pull/5.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#5>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAGZuCOumbhdvjPgGW7TjlVHiSqQMBbNks5tCou7gaJpZM4RKE3b> .
-- Ondřej Mirtes

Copy link
Contributor Author

mhujer commented Dec 28, 2017

I've created an issue with the list of ideas for additional rules #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /