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

feat(phpunit): consider data providers in children classes as valid test entrypoints #97

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Sep 25, 2024

I expected this would break some tests but it does not 🤷🏾‍♀️

abstract class TestCaseBase extends TestCase
{
    abstract public static function providerTest(): array;

    #[DataProvider('providerTest')]
    public function testFoo(string|null $phpValue, string|null $serialized): void
    {
    }
}

final class SomeExtendingTest extends TestCaseBase
{
    public static function providerTest(): array
    {
        return [];
    }
}

Data providers in children classes are also valid entrypoints.

@janedbal janedbal merged commit 41ee3cd into shipmonk-rnd:master Sep 25, 2024
12 checks passed
@janedbal
Copy link
Member

Thanks!

@simPod simPod deleted the inherited-test-entrypoints branch September 25, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants