chore: code format

This commit is contained in:
Maël Gangloff
2025-09-10 00:11:05 +02:00
parent 477bf36893
commit 08ff41c3d0
4 changed files with 27 additions and 40 deletions

View File

@@ -41,7 +41,7 @@ class RegisterDomainCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$ldhName = RDAPService::convertToIdn($input->getArgument('domain'));
$ldhName = RDAPService::convertToIdn($input->getArgument('domain'));
$force = (bool) $input->getOption('force');
$notif = (bool) $input->getOption('notif');
$domain = $this->domainRepository->findOneBy(['ldhName' => $ldhName]);

View File

@@ -203,7 +203,7 @@ class RDAPService
throw new BadRequestException('Domain must contain at least one dot');
}
$tld = self::convertToIdn((substr($domain, $lastDotPosition + 1)));
$tld = self::convertToIdn(substr($domain, $lastDotPosition + 1));
$tldEntity = $this->tldRepository->findOneBy(['tld' => $tld]);
if (null === $tldEntity) {

View File

@@ -7,9 +7,6 @@ namespace App\Tests\Entity;
use App\Entity\Domain;
use App\Entity\DomainEvent;
use App\Entity\DomainStatus;
use DateInterval;
use DateTimeImmutable;
use Exception;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
@@ -52,7 +49,7 @@ final class DomainTest extends TestCase
}
/**
* @throws Exception
* @throws \Exception
*/
public function testGetExpiresInDays(): void
{
@@ -68,7 +65,7 @@ final class DomainTest extends TestCase
(new Domain())
->addEvent(
(new DomainEvent())
->setDate((new DateTimeImmutable())->add(new DateInterval('P10D')))
->setDate((new \DateTimeImmutable())->add(new \DateInterval('P10D')))
->setAction('expiration')
->setDeleted(false)
)->getExpiresInDays(),
@@ -83,8 +80,8 @@ final class DomainTest extends TestCase
(new DomainStatus())
->setAddStatus(['pending delete'])
->setDeleteStatus(['active'])
->setCreatedAt(new DateTimeImmutable())
->setDate(new DateTimeImmutable())
->setCreatedAt(new \DateTimeImmutable())
->setDate(new \DateTimeImmutable())
)->getExpiresInDays(),
'Guess based on domain EPP status'
);
@@ -97,8 +94,8 @@ final class DomainTest extends TestCase
(new DomainStatus())
->setAddStatus(['redemption period'])
->setDeleteStatus(['active'])
->setCreatedAt(new DateTimeImmutable())
->setDate(new DateTimeImmutable())
->setCreatedAt(new \DateTimeImmutable())
->setDate(new \DateTimeImmutable())
)->getExpiresInDays(),
'Domain name entered in the redemption period'
);
@@ -109,7 +106,7 @@ final class DomainTest extends TestCase
->setStatus(['pending delete'])
->addEvent(
(new DomainEvent())
->setDate((new DateTimeImmutable())->sub(new DateInterval('P10D')))
->setDate((new \DateTimeImmutable())->sub(new \DateInterval('P10D')))
->setAction('expiration')
->setDeleted(false)
)
@@ -117,8 +114,8 @@ final class DomainTest extends TestCase
(new DomainStatus())
->setAddStatus(['pending delete'])
->setDeleteStatus(['active'])
->setCreatedAt(new DateTimeImmutable())
->setDate(new DateTimeImmutable())
->setCreatedAt(new \DateTimeImmutable())
->setDate(new \DateTimeImmutable())
)->getExpiresInDays(),
'Domain name entered in the pending delete period'
);
@@ -129,7 +126,7 @@ final class DomainTest extends TestCase
->setStatus(['pending delete'])
->addEvent(
(new DomainEvent())
->setDate((new DateTimeImmutable())->sub(new DateInterval('P' . (45 + 30 + 4) . 'D')))
->setDate((new \DateTimeImmutable())->sub(new \DateInterval('P'.(45 + 30 + 4).'D')))
->setAction('expiration')
->setDeleted(false)
)
@@ -137,8 +134,8 @@ final class DomainTest extends TestCase
(new DomainStatus())
->setAddStatus(['pending delete'])
->setDeleteStatus(['active'])
->setCreatedAt(new DateTimeImmutable())
->setDate(new DateTimeImmutable())
->setCreatedAt(new \DateTimeImmutable())
->setDate(new \DateTimeImmutable())
)->getExpiresInDays(),
'Guess based on domain status in priority'
);
@@ -154,7 +151,7 @@ final class DomainTest extends TestCase
->setStatus(['pending delete'])
->addEvent(
(new DomainEvent())
->setDate(new DateTimeImmutable())
->setDate(new \DateTimeImmutable())
->setAction('deletion')
->setDeleted(false)
)->getExpiresInDays(),
@@ -164,7 +161,7 @@ final class DomainTest extends TestCase
public function testSetLdhName(): void
{
/**
/*
* @see https://en.wikipedia.org/wiki/IDN_Test_TLDs
*/
$this->assertEquals('xn--zckzah',
@@ -185,7 +182,7 @@ final class DomainTest extends TestCase
public static function isToBeUpdatedProvider(): array
{
$now = new DateTimeImmutable();
$now = new \DateTimeImmutable();
return [
// 1. updatedAt >= 7 days -> true
@@ -218,20 +215,19 @@ final class DomainTest extends TestCase
}
/**
* @throws Exception
* @throws \Exception
*/
#[DataProvider('isToBeUpdatedProvider')]
public function testIsToBeUpdated(
DateTimeImmutable $updatedAt,
bool $deleted,
bool $fromUser,
bool $intensifyLastDay,
int $expiresIn,
bool $watchClosely,
array $status,
bool $expected,
): void
{
\DateTimeImmutable $updatedAt,
bool $deleted,
bool $fromUser,
bool $intensifyLastDay,
int $expiresIn,
bool $watchClosely,
array $status,
bool $expected,
): void {
$mock = $this->getMockBuilder(Domain::class)
->onlyMethods(['getUpdatedAt', 'getDeleted', 'getExpiresInDays', 'isToBeWatchClosely', 'getStatus'])
->getMock();

View File

@@ -1,9 +0,0 @@
<?php
namespace App\Tests\Service;
use PHPUnit\Framework\TestCase;
class RDAPServiceTest extends TestCase
{
}