chore: rename WatchList to Watchlist

This commit is contained in:
Maël Gangloff
2025-10-25 17:26:56 +02:00
parent ff90477695
commit 5243b3c2dd
32 changed files with 278 additions and 199 deletions

View File

@@ -3,10 +3,10 @@
namespace App\Tests\Controller;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Entity\WatchList;
use App\Entity\Watchlist;
use App\Tests\AuthenticatedUserTrait;
use App\Tests\Service\RDAPServiceTest;
use App\Tests\State\WatchListUpdateProcessorTest;
use App\Tests\State\WatchlistUpdateProcessorTest;
use PHPUnit\Framework\Attributes\DependsExternal;
use Zenstruck\Foundry\Test\Factories;
@@ -18,12 +18,12 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetWatchlistCollection(): void
{
$client = WatchListUpdateProcessorTest::createUserAndWatchlist();
$client = WatchlistUpdateProcessorTest::createUserAndWatchlist();
$response = $client->request('GET', '/api/watchlists');
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(WatchList::class);
$this->assertMatchesResourceCollectionJsonSchema(Watchlist::class);
$data = $response->toArray();
$this->assertArrayHasKey('hydra:member', $data);
@@ -33,7 +33,7 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetTrackedDomains()
{
$client = WatchListUpdateProcessorTest::createUserAndWatchlist(null, ['/api/domains/example.org']);
$client = WatchlistUpdateProcessorTest::createUserAndWatchlist(null, ['/api/domains/example.org']);
$response = $client->request('GET', '/api/tracked');
$this->assertResponseIsSuccessful();
@@ -46,7 +46,7 @@ final class WatchlistControllerTest extends ApiTestCase
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
public function testGetWatchlistFeeds()
{
$client = WatchListUpdateProcessorTest::createUserAndWatchlist();
$client = WatchlistUpdateProcessorTest::createUserAndWatchlist();
$response = $client->request('GET', '/api/watchlists');
$token = $response->toArray()['hydra:member'][0]['token'];

View File

@@ -6,13 +6,13 @@ use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use App\Config\ConnectorProvider;
use App\Entity\Domain;
use App\Entity\Tld;
use App\Entity\WatchList;
use App\Entity\Watchlist;
use App\Factory\UserFactory;
use App\Message\OrderDomain;
use App\MessageHandler\OrderDomainHandler;
use App\Tests\Controller\ConnectorControllerTest;
use App\Tests\Service\RDAPServiceTest;
use App\Tests\State\WatchListUpdateProcessorTest;
use App\Tests\State\WatchlistUpdateProcessorTest;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\Attributes\DependsExternal;
use Symfony\Component\HttpClient\Exception\ServerException;
@@ -89,12 +89,12 @@ class AbstractProviderTest extends ApiTestCase
$entityManager = self::getContainer()->get(EntityManagerInterface::class);
// Create a Watchlist with the domain name
WatchListUpdateProcessorTest::createUserAndWatchlist($client,
WatchlistUpdateProcessorTest::createUserAndWatchlist($client,
['/api/domains/example.com'],
'/api/connectors/'.$response->toArray()['id']);
$response = $client->request('GET', '/api/watchlists');
$watchlist = $entityManager->getRepository(WatchList::class)->findOneBy(['token' => $response->toArray()['hydra:member'][0]['token']]);
$watchlist = $entityManager->getRepository(Watchlist::class)->findOneBy(['token' => $response->toArray()['hydra:member'][0]['token']]);
$domain = (new Domain())
->setLdhName((new UuidV4()).'.com')

View File

@@ -4,14 +4,14 @@ namespace App\Tests\State;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
use ApiPlatform\Symfony\Bundle\Test\Client;
use App\Entity\WatchList;
use App\Entity\Watchlist;
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 WatchListUpdateProcessorTest extends ApiTestCase
final class WatchlistUpdateProcessorTest extends ApiTestCase
{
use Factories;
use AuthenticatedUserTrait;
@@ -22,7 +22,7 @@ final class WatchListUpdateProcessorTest extends ApiTestCase
self::createUserAndWatchlist();
$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(201);
$this->assertMatchesResourceItemJsonSchema(WatchList::class);
$this->assertMatchesResourceItemJsonSchema(Watchlist::class);
}
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
@@ -48,7 +48,7 @@ final class WatchListUpdateProcessorTest extends ApiTestCase
'trackedEppStatus' => [],
]]);
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceItemJsonSchema(WatchList::class);
$this->assertMatchesResourceItemJsonSchema(Watchlist::class);
$data = $response->toArray();
$this->assertCount(2, $data['domains']);
$this->assertCount(1, $data['trackedEvents']);