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

@depends doesnt work with @testWith #3450

Closed
NikoGrano opened this issue Dec 11, 2018 · 5 comments
Closed

@depends doesnt work with @testWith #3450

NikoGrano opened this issue Dec 11, 2018 · 5 comments

Comments

@NikoGrano
Copy link

Q A
PHPUnit version 7.5
PHP version 7.1
Installation Method Composer

There is issue when returning value from depended-upon test. It will always return null when using data sets.

Fix will be introduced in #3449

NikoGrano added a commit to NikoGrano/phpunit that referenced this issue Dec 11, 2018
@NikoGrano
Copy link
Author

This issue can be closed when #3449 is merged.

NikoGrano added a commit to NikoGrano/phpunit that referenced this issue Dec 11, 2018
@epdenouden
Copy link
Contributor

@Niko9911 What is the exact issue here? In case it is a variant of the issue demonstrated below, the TL;DR is that this is a result of the current architecture and cannot be changed easily. If you search the github issues for 'dataprovider' and 'depends' you will find quite a lot of discussion.

The code below shows that depending on a dataprovidered tests will not automatically rerun the test for every dataprovider row of the test referenced in @depends.

<?php
class DataproviderAsDependencyParameterTest extends \PHPUnit\Framework\TestCase
{
    /**
     * @testdox testA($value)
     * @depends testB
     */
    public function testA($value): void
    {
        $this->assertTrue(true);
    }

    /**
     * @testdox testB($value)
     * @dataProvider someProvider
     */
    public function testB($value): void
    {
        $this->assertTrue(true);
    }

    public function someProvider()
    {
        return [
            [1],
            [2],
            [3],
        ];
    }
}

@NikoGrano
Copy link
Author

hmph, I was stypid as I didn't post reproduce here... It was something about if dependency was in x class...

@sebastianbergmann
Copy link
Owner

Can this be closed?

@epdenouden
Copy link
Contributor

I think so, yes. It is a request that pops up every now and then. Having looked at the way dataproviders work it won't be a simple change to get this working.

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

No branches or pull requests

3 participants