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

Enhancement: Implement Classes\PHPUnit\Framework\TestCaseWithSuffixRule #225

Merged

Conversation

localheinz
Copy link
Member

This PR

  • implements Classes\PHPUnit\Framework\TestCaseWithSuffixRule, which reports an error when a concrete sub-class of PHPUnit\Framework\TestCase does not have a Test suffix

@codecov
Copy link

codecov bot commented May 10, 2020

Codecov Report

Merging #225 into master will decrease coverage by 0.44%.
The diff coverage is 77.41%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #225      +/-   ##
============================================
- Coverage     84.32%   83.88%   -0.45%     
- Complexity      138      149      +11     
============================================
  Files            22       23       +1     
  Lines           453      484      +31     
============================================
+ Hits            382      406      +24     
- Misses           71       78       +7     
Impacted Files Coverage Δ Complexity Δ
...asses/PHPUnit/Framework/TestCaseWithSuffixRule.php 77.41% <77.41%> (ø) 11.00 <11.00> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cebf79a...bdccf23. Read the comment docs.

@localheinz localheinz marked this pull request as ready for review May 10, 2020 18:37
@localheinz localheinz force-pushed the feature/phpunit-framework-test-case-with-suffix-rule branch from 8b63818 to bdccf23 Compare May 10, 2020 18:37
@ergebnis-bot ergebnis-bot self-requested a review May 10, 2020 18:39
@ergebnis-bot ergebnis-bot self-assigned this May 10, 2020
@ergebnis-bot ergebnis-bot merged commit f0c49d0 into master May 10, 2020
@ergebnis-bot ergebnis-bot deleted the feature/phpunit-framework-test-case-with-suffix-rule branch May 10, 2020 18:39
@TomasVotruba
Copy link

Looks like class name in PR description is too short.

Should be Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule instead

@TomasVotruba
Copy link

TomasVotruba commented May 15, 2020

It doesn't work for me :/

# phpstan.neon
services:
    -
         class: Ergebnis\PHPStan\Rules\Classes\PHPUnit\Framework\TestCaseWithSuffixRule
         tags:
                 - phpstan.rules.rule

<?php

use PHPUnit\Framework\TestCase

// this should report error, but missed
class JsonOutputFormatterA extends AbstractKernelTestCase {
}

class AbstractKernelTestCase extends TestCase {
}

@TomasVotruba
Copy link

Running clear cache didn't help:

vendor/bin/phpstan clear-result-cache

@TomasVotruba
Copy link

Weird. Running PHPStan with --debug helped

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

Successfully merging this pull request may close these issues.

None yet

3 participants