Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upStrict and opinionated rules for PHPUnit #5
Conversation
|
This is perfect! |
|
Btw what about assertInstanceof + the negative variant? That could also be
enforced
On Thu, 21 Dec 2017 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
|
|
I've created an issue with the list of ideas for additional rules #7 |
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 ;-))