I'm experiencing a strange behavior during my tests. I'm getting this error at the end:
RuntimeException: Cannot get Foundry's configuration. If using faker in a data provider, consider passing attributes as a callable.
I have a file AdminLoginTest.php in /tests/Functional.
<?php
declare(strict_types=1);
namespace App\Tests\Functional;
use App\Factory\UserFactory;
use Zenstruck\Browser\HttpOptions;
class AdminLoginTest extends ApiTestCase
{
public function testAdminUserLogin(): void
{
$user = UserFactory::new()->withRoles(['ROLE_ADMIN'])->create();
dump($user);
$this->browser()
->post('/api/admin/accounts/status', HttpOptions::json([
'username' => $user->getUsername()
]))
->assertSuccessful()
->assertJson()
->dump();
}
}
The strange thing is, just by renaming the file to XAdminLoginTest.php and the Class to XAdminLoginTest every test runs fine.
If I run a single Test "XAdminLoginTest", then the message reappears.
If the test is the first Test on the list, then the message reappears.
Any ideas?
Removing vendor, composer i -> no help
composer update -> no help
Symfony 6.3
api-platform/core v3.1.15 Build a fully-featured hypermedia or GraphQL API in minutes!
dama/doctrine-test-bundle v7.2.1 Symfony bundle to isolate doctrine database tests and improve test performance
doctrine/data-fixtures 1.6.7 Data Fixtures for all Doctrine Object Managers
zenstruck/assert v1.4.0 Standalone, lightweight, framework agnostic, test assertion library.
zenstruck/browser v1.4.0 A fluent interface for your Symfony functional tests.
zenstruck/callback v1.5.0 Callable wrapper to validate and inject arguments.
zenstruck/foundry v1.35.0 A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
zenstruck/mailer-test v1.3.0 Alternative, opinionated helpers for testing emails sent with symfony/mailer.
Hello,
I'm experiencing a strange behavior during my tests. I'm getting this error at the end:
RuntimeException: Cannot get Foundry's configuration. If using faker in a data provider, consider passing attributes as a callable.
I have a file AdminLoginTest.php in
/tests/Functional
.The strange thing is, just by renaming the file to XAdminLoginTest.php and the Class to XAdminLoginTest every test runs fine. If I run a single Test "XAdminLoginTest", then the message reappears. If the test is the first Test on the list, then the message reappears.
Any ideas?