tests/Entity/UserExtendedTest.php (8 nouveaux tests): - testSetIsEmailAuthEnabled: active l'auth email, verifie true sans keycloakId et false avec keycloakId - testSetIsGoogleAuthEnabled: active Google Auth + secret - testClearTempPassword: verifie clearTempPassword() met hasTempPassword a false - testGenerateBackupCodes: genere 5 codes, verifie le count - testSerializeUnserialize: serialise/deserialise, verifie l'email - testCreatedAt: verifie le type DateTimeImmutable - testUpdatedAt: null par defaut - testEraseCredentials: appel sans erreur tests/Entity/RevendeurTest.php (nouveau, 10 tests): - testConstructor: id null, codeRevendeur, user, createdAt, isActive - testRaisonSociale: get/set nullable - testSiret: get/set - testAddress: address, zipCode, city - testContact: email, phone - testStripeConnect: stripeConnectId, isUseStripe - testStripeConnectState: state, statePayment, statePayout - testContratPdf: unsigned, signed, audit, submitterId - testActive: setIsActive false - testUpdatedAt: get/set nullable tests/Entity/ServiceTest.php (nouveau, 12 tests): - testConstructor: tous les champs par defaut - testSetName, testSetUrl, testSetStatus (avec message) - testExternal: isExternal, externalType - testPosition: get/set - testStatusHistory: collection vide - testCategory: verifie la relation - testComputeUptimeRatioAllUp: 2 entries up = 100% - testComputeUptimeRatioMixed: ratio entre 0 et 100 - testComputeUptimeRatioEmpty: pas d'historique = 100% tests/Entity/ServiceCategoryTest.php (nouveau, 3 tests): - testConstructor: name, slug, position 0, createdAt, services vide - testSetName: modification du nom - testSetPosition: modification de la position Resultat: 294 tests, 534 assertions, 0 failures, 0 deprecations, 0 notices Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
985 B
PHP
35 lines
985 B
PHP
<?php
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
use App\Entity\ServiceCategory;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ServiceCategoryTest extends TestCase
|
|
{
|
|
public function testConstructor(): void
|
|
{
|
|
$cat = new ServiceCategory('Infrastructure', 'infra');
|
|
$this->assertNull($cat->getId());
|
|
$this->assertSame('Infrastructure', $cat->getName());
|
|
$this->assertSame('infra', $cat->getSlug());
|
|
$this->assertSame(0, $cat->getPosition());
|
|
$this->assertInstanceOf(\DateTimeImmutable::class, $cat->getCreatedAt());
|
|
$this->assertCount(0, $cat->getServices());
|
|
}
|
|
|
|
public function testSetName(): void
|
|
{
|
|
$cat = new ServiceCategory('Web', 'web');
|
|
$cat->setName('Email');
|
|
$this->assertSame('Email', $cat->getName());
|
|
}
|
|
|
|
public function testSetPosition(): void
|
|
{
|
|
$cat = new ServiceCategory('Web', 'web');
|
|
$cat->setPosition(3);
|
|
$this->assertSame(3, $cat->getPosition());
|
|
}
|
|
}
|