mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
test: update test suite
This commit is contained in:
parent
ddee6df4bd
commit
00469cad6b
@ -84,7 +84,7 @@ class Domain
|
||||
* @var Collection<int, DomainEntity>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'domain', cascade: ['persist'], orphanRemoval: true)]
|
||||
#[Groups(['domain:item'])]
|
||||
#[Groups(['domain:item', 'watchlist:item'])]
|
||||
#[SerializedName('entities')]
|
||||
private Collection $domainEntities;
|
||||
|
||||
@ -106,7 +106,7 @@ class Domain
|
||||
joinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name')],
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'nameserver_ldh_name', referencedColumnName: 'ldh_name')]
|
||||
)]
|
||||
#[Groups(['domain:item'])]
|
||||
#[Groups(['domain:item', 'watchlist:item'])]
|
||||
private Collection $nameservers;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||
|
||||
@ -48,11 +48,11 @@ class Entity
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: Tld::class, inversedBy: 'entities')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: false)]
|
||||
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
|
||||
#[Groups(['entity:list', 'entity:item', 'domain:item', 'watchlist:item'])]
|
||||
private ?Tld $tld = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
|
||||
#[Groups(['entity:list', 'entity:item', 'domain:item', 'watchlist:item'])]
|
||||
private ?string $handle = null;
|
||||
|
||||
/**
|
||||
@ -85,11 +85,11 @@ class Entity
|
||||
'items' => ['type' => 'array'],
|
||||
]
|
||||
)]
|
||||
#[Groups(['entity:item', 'domain:item'])]
|
||||
#[Groups(['entity:item', 'domain:item', 'watchlist:item'])]
|
||||
private array $jCard = [];
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
#[Groups(['entity:item', 'domain:item'])]
|
||||
#[Groups(['entity:item', 'domain:item', 'watchlist:item'])]
|
||||
private ?array $remarks = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'entities')]
|
||||
|
||||
@ -52,7 +52,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
normalizationContext: [
|
||||
'groups' => [
|
||||
'watchlist:item',
|
||||
'domain:item',
|
||||
'domain:list',
|
||||
'event:list',
|
||||
'domain-entity:entity',
|
||||
'nameserver-entity:nameserver',
|
||||
@ -90,7 +90,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
processor: WatchListUpdateProcessor::class,
|
||||
),
|
||||
new Put(
|
||||
normalizationContext: ['groups' => 'watchlist:item'],
|
||||
normalizationContext: ['groups' => 'watchlist:list'],
|
||||
denormalizationContext: ['groups' => ['watchlist:update']],
|
||||
security: 'object.user == user',
|
||||
processor: WatchListUpdateProcessor::class,
|
||||
|
||||
@ -33,7 +33,7 @@ final class WatchlistControllerTest extends ApiTestCase
|
||||
#[DependsExternal(RDAPServiceTest::class, 'testUpdateRdapServers')]
|
||||
public function testGetTrackedDomains()
|
||||
{
|
||||
$client = WatchListUpdateProcessorTest::createUserAndWatchlist();
|
||||
$client = WatchListUpdateProcessorTest::createUserAndWatchlist(null, ['/api/domains/example.org']);
|
||||
$response = $client->request('GET', '/api/tracked');
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
@ -53,11 +53,11 @@ final class WatchListUpdateProcessorTest extends ApiTestCase
|
||||
$this->assertCount(1, $data['trackedEvents']);
|
||||
}
|
||||
|
||||
public static function createUserAndWatchlist(?Client $client = null): Client
|
||||
public static function createUserAndWatchlist(?Client $client = null, array $domains = ['/api/domains/example.com']): Client
|
||||
{
|
||||
$client = $client ?? self::createClientWithCredentials(self::getToken(UserFactory::createOne()));
|
||||
$client->request('POST', '/api/watchlists', ['json' => [
|
||||
'domains' => ['/api/domains/example.com'],
|
||||
'domains' => $domains,
|
||||
'name' => 'My Watchlist',
|
||||
'trackedEvents' => ['last changed', 'transfer', 'expiration', 'deletion'],
|
||||
]]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user