Skip to content

[Feature Request] New rule for making sure parent setUp or tearDown methods are called if extending custom base test case #78

@canvural

Description

@canvural

It's common to create a base TestCase that defines some logic in setUp and tearDown methods of PHPUnit. Laravel, Symfony etc. does this.

So when a user is overriding the setUp or tearDown in a specific test class, forgetting to call parent::setUp() can cause some issues. (I got bitten by this today. Forgot to call parent::tearDown so database transactions were not committed. Apparently Laravel does this in it's tearDown)

It'd be good to have a rule that catches that. It should be a little smart about it, and only warn when parent setUp or tearDown is not the base PHPUnit TestCase.

If this is something that you see value in, I can try to implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions