You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test which is using a data provider. It runs as expected when running the whole file, however the individual test filter does not account for data providers.
Example Test:
use Tests\TestCase;
class ExampleTest extends TestCase
{
function exampleDataProvider()
{
return [
['foo'],
];
}
/**
* @test
* @dataProvider exampleDataProvider
*/
function example_test($foo)
{
$this->assertSame('foo', $foo);
}
}
Output when running run_phpunit_test:
cd /Users/adamtomat/Sites/<repo> && /Users/adamtomat/Sites/<repo>/vendor/phpunit/phpunit/phpunit /Users/adamtomat/Sites/<repo>/tests/Feature/ExampleTest.php
OK (1 test, 1 assertion)
Output when running run_single_phpunit_test:
cd /Users/adamtomat/Sites/<repo> && /Users/adamtomat/Sites/<repo>/vendor/phpunit/phpunit/phpunit /Users/adamtomat/Sites/<repo>/tests/Feature/ExampleTest.php --filter '/::example_test$/'
No tests executed!
After a little searching around, it looks like the filter needs to account for tests with data providers, which explains why it doesn't work:
I have a test which is using a data provider. It runs as expected when running the whole file, however the individual test filter does not account for data providers.
Example Test:
Output when running
run_phpunit_test
:Output when running
run_single_phpunit_test
:After a little searching around, it looks like the filter needs to account for tests with data providers, which explains why it doesn't work:
https://stackoverflow.com/questions/12193606/cannot-run-single-test-with-data-provider-in-phpunit
The text was updated successfully, but these errors were encountered: