When i try to use parallel test with dataProvider, i get an unwkonw error In WorkerCrashedException.php line 43.
My code:
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Facade\Ignition\Support\ComposerClassMap;
use Illuminate\Support\Str;
class ModelosTest extends TestCase
{
public function pegaTodosOsModels()
{
$namespaces = array_keys((new ComposerClassMap())->listClasses());
return array_filter($namespaces, function ($item) {
return Str::startsWith($item, "App\\Models\\");
});
}
public function modelsProvider(): array
{
$this->createApplication();
$arrayParaVoltar = [];
foreach ($this->pegaTodosOsModels() as $models) {
$arrayParaVoltar[$models] = [new $models];
}
return $arrayParaVoltar;
}
/**
* @dataProvider modelsProvider
*/
public function test_fillable_audit($model)
{
$diff = array_diff($model->getFillable(), $model->getAuditInclude());
$this->assertEquals([], $diff, 'fillable está diferente do audit');
}
}
Command that i use: php artisan test --parallel --runner=WrapperRunner
error message:
Running phpunit in 12 processes with /home/lucas/projects/siga/vendor/phpunit/phpunit/phpunit
Configuration read from /home/lucas/projects/siga/phpunit.xml
.
In WorkerCrashedException.php line 43:
The command "PARATEST='1' TEST_TOKEN='2' UNIQUE_TEST_TOKEN='2_62865181cfc55' '/home/lucas/projects/siga/vendor/phpunit/phpunit/phpunit' '--configuration' '/home/lucas/projects/siga/phpunit.xml' '--no-logging'
'--no-coverage' '--printer' 'ParaTest\Runners\PHPUnit\Worker\NullPhpunitPrinter' '--log-junit' '/tmp/PT_ChG0pg' '/home/lucas/projects/siga/tests/Feature/ModelsTest.php'" failed.
Exit Code: 1(General error)
Working directory: /home/lucas/projects/siga
Output:
================
Class 'ModelsTest' could not be found in '/home/lucas/projects/siga/tests/Feature/ModelsTest.php'.
Error Output:
================
if i comment my dataProvider, all my tests works fine.
When i try to use parallel test with dataProvider, i get an unwkonw error In WorkerCrashedException.php line 43.
My code:
Command that i use:
php artisan test --parallel --runner=WrapperRunner
error message:
if i comment my dataProvider, all my tests works fine.