fix: use state provider

This commit is contained in:
Maël Gangloff
2025-10-14 23:34:17 +02:00
parent b0f5daf6f3
commit ebdc5151ee
8 changed files with 89 additions and 200 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Tests\State;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Entity\Domain;
use App\Factory\UserFactory;
use App\Tests\AuthenticatedUserTrait;
use App\Tests\Service\RDAPServiceTest;
use PHPUnit\Framework\Attributes\DependsExternal;
use Zenstruck\Foundry\Test\Factories;
final class AutoRegisterDomainProviderTest extends ApiTestCase
{
use Factories;
use AuthenticatedUserTrait;
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testRegisterDomain(): void
{
$testUser = UserFactory::createOne();
$client = AutoRegisterDomainProviderTest::createClientWithCredentials(AutoRegisterDomainProviderTest::getToken($testUser));
$client->request('GET', '/api/domains/example.com');
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceItemJsonSchema(Domain::class);
}
}