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

Make sure test methods have @test annotation #26

Open
OndraM opened this issue Sep 11, 2018 · 0 comments
Open

Make sure test methods have @test annotation #26

OndraM opened this issue Sep 11, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@OndraM
Copy link
Member

OndraM commented Sep 11, 2018

If we use @test annotations to declare test methods, you may forgot to add the annotation, leading to the test method being silently ignored and not executed.

    public function shouldDoSomething(): void
    {
         // ...
    }

We could make fixer to make sure public method starting with "should" (which is our convention for test method names) have the @test annotation. (This must apply only to PHPUnit test files, ie. files having "Test.php" suffix).

Also make sure we cover case when @test annotation is wrongly declared (missing space - /**@test */) and thus undetected by PHPUnit as test method.

Note - there is PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer, but it does only unifies the style, even with style set to "annotations", it won't detect methods missing the annotation.

@OndraM OndraM added the enhancement New feature or request label Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant