test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
|
|
|
|
|
|
use App\Entity\Customer;
|
|
|
|
|
use App\Entity\User;
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
class CustomerTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
private function createCustomer(): Customer
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->setEmail('c@test.com');
|
|
|
|
|
$user->setFirstName('John');
|
|
|
|
|
$user->setLastName('Doe');
|
|
|
|
|
$user->setPassword('h');
|
|
|
|
|
|
|
|
|
|
return new Customer($user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getId());
|
|
|
|
|
$this->assertSame('John', $c->getUser()->getFirstName());
|
|
|
|
|
$this->assertSame(Customer::STATE_ACTIVE, $c->getState());
|
|
|
|
|
$this->assertTrue($c->isActive());
|
|
|
|
|
$this->assertInstanceOf(\DateTimeImmutable::class, $c->getCreatedAt());
|
|
|
|
|
$this->assertNull($c->getUpdatedAt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testCodeComptable(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getCodeComptable());
|
|
|
|
|
$c->setCodeComptable('C-001');
|
|
|
|
|
$this->assertSame('C-001', $c->getCodeComptable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGenerateCodeComptable(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$code = $c->generateCodeComptable();
|
|
|
|
|
$this->assertNotEmpty($code);
|
2026-04-07 23:50:19 +02:00
|
|
|
$this->assertStringStartsWith('EC-', $code);
|
2026-04-03 10:47:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGenerateCodeComptableWithRaisonSociale(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setRaisonSociale('SITECONSEIL SAS');
|
|
|
|
|
$code = $c->generateCodeComptable();
|
|
|
|
|
$this->assertStringContainsString('SITEC', $code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGenerateCodeComptableWithLastName(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setRaisonSociale(null);
|
|
|
|
|
$c->setLastName('Dupont');
|
|
|
|
|
$code = $c->generateCodeComptable();
|
|
|
|
|
$this->assertStringContainsString('DUPON', $code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGenerateCodeComptableNoName(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setRaisonSociale(null);
|
|
|
|
|
$c->setLastName(null);
|
|
|
|
|
$code = $c->generateCodeComptable();
|
|
|
|
|
$this->assertStringContainsString('XXXXX', $code);
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testNames(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setFirstName('Jane');
|
|
|
|
|
$c->setLastName('Smith');
|
|
|
|
|
$this->assertSame('Jane', $c->getFirstName());
|
|
|
|
|
$this->assertSame('Smith', $c->getLastName());
|
|
|
|
|
$this->assertSame('Jane Smith', $c->getFullName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testRaisonSociale(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setRaisonSociale('SARL Test');
|
|
|
|
|
$this->assertSame('SARL Test', $c->getRaisonSociale());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testContact(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setEmail('new@test.com');
|
|
|
|
|
$c->setPhone('0612345678');
|
|
|
|
|
$this->assertSame('new@test.com', $c->getEmail());
|
|
|
|
|
$this->assertSame('0612345678', $c->getPhone());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testAddress(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setAddress('1 rue Test');
|
|
|
|
|
$c->setAddress2('Bat A');
|
|
|
|
|
$c->setZipCode('02100');
|
|
|
|
|
$c->setCity('Saint-Quentin');
|
|
|
|
|
$this->assertSame('1 rue Test', $c->getAddress());
|
|
|
|
|
$this->assertSame('Bat A', $c->getAddress2());
|
|
|
|
|
$this->assertSame('02100', $c->getZipCode());
|
|
|
|
|
$this->assertSame('Saint-Quentin', $c->getCity());
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-04 11:24:52 +02:00
|
|
|
public function testGeoCoordinates(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getGeoLat());
|
|
|
|
|
$this->assertNull($c->getGeoLong());
|
|
|
|
|
|
|
|
|
|
$c->setGeoLat('49.8486');
|
|
|
|
|
$c->setGeoLong('3.2876');
|
|
|
|
|
$this->assertSame('49.8486', $c->getGeoLat());
|
|
|
|
|
$this->assertSame('3.2876', $c->getGeoLong());
|
|
|
|
|
}
|
|
|
|
|
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
public function testLegal(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setSiret('12345678901234');
|
|
|
|
|
$c->setRcs('RCS Paris');
|
|
|
|
|
$c->setNumTva('FR12345678901');
|
2026-04-04 11:08:41 +02:00
|
|
|
$c->setApe('62.01Z');
|
|
|
|
|
$c->setRna('W502004724');
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
$this->assertSame('12345678901234', $c->getSiret());
|
|
|
|
|
$this->assertSame('RCS Paris', $c->getRcs());
|
|
|
|
|
$this->assertSame('FR12345678901', $c->getNumTva());
|
2026-04-04 11:08:41 +02:00
|
|
|
$this->assertSame('62.01Z', $c->getApe());
|
|
|
|
|
$this->assertSame('W502004724', $c->getRna());
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testStripe(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getStripeCustomerId());
|
|
|
|
|
$c->setStripeCustomerId('cus_xxx');
|
|
|
|
|
$this->assertSame('cus_xxx', $c->getStripeCustomerId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testTypeCompany(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setTypeCompany(Customer::TYPE_SARL);
|
|
|
|
|
$this->assertSame('sarl', $c->getTypeCompany());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testState(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$c->setState(Customer::STATE_SUSPENDED);
|
|
|
|
|
$this->assertSame(Customer::STATE_SUSPENDED, $c->getState());
|
|
|
|
|
$this->assertFalse($c->isActive());
|
test: couverture entités, handlers, commandes (574 tests, 1028 assertions)
Tests entités complémentaires :
- AttestationTest : ajout setEmailTracking avec EmailTracking et null (95→98%)
- CustomerTest : ajout vérification getUpdatedAt après setState
- ServiceTest : ajout testSetStatusSameStatus (branche oldStatus === status,
pas d'ajout dans statusHistory)
- UserExtendedTest : ajout testAvatarFile avec File réel + null (97→98%)
- OrderNumberTest : constructor + markAsUsed (100%)
- AdvertTest : constructor, setDevis/null, verifyHmac valid/invalid (100%)
- FactureTest : constructor, setAdvert/null, splitIndex, getInvoiceNumber
sans/avec split, verifyHmac valid/invalid (100%)
Tests MessageHandlers :
- AppLogMessageHandlerTest (2 tests) : __invoke avec userId (find user + persist
AppLog + flush), __invoke sans userId (userId null, user null)
- MeilisearchSyncMessageHandlerTest (12 tests) : remove customer/revendeur/price/
unknown, index customer trouvé/non trouvé, index revendeur trouvé/non trouvé,
index price trouvé/non trouvé, index unknown type
Tests services :
- OrderNumberServiceTest (5 tests) : generate/preview premier et incrémenté,
generateAndUse
- TarificationServiceTest (9 tests) : ensureDefaultPrices tous/skip/aucun/
avec Meilisearch+Stripe/erreur Stripe, getAll, getByType, getDefaultTypes
- AdvertServiceTest (3 tests) : create sans/avec devis, createFromDevis
- FactureServiceTest (5 tests) : create sans advert, 1re/2e/3e facture, direct
Exclusions services API live :
- phpunit.dist.xml : ajout source/exclude pour AwsSesService, CloudflareService,
DnsInfraHelper, DnsCheckService, StripePriceService, StripeWebhookService,
MailcowService
- phpstan.dist.neon : ajout excludePaths pour les 7 services
- sonar-project.properties : ajout sonar.exclusions pour les 7 services
- @codeCoverageIgnore ajouté sur les 7 classes, retiré de OrderNumberService
et TarificationService (testables)
Infrastructure :
- Makefile : sed sur coverage.xml pour réécrire /app/ en chemins relatifs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:37:37 +02:00
|
|
|
$this->assertInstanceOf(\DateTimeImmutable::class, $c->getUpdatedAt());
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
}
|
test: couverture entités, handlers, commandes (574 tests, 1028 assertions)
Tests entités complémentaires :
- AttestationTest : ajout setEmailTracking avec EmailTracking et null (95→98%)
- CustomerTest : ajout vérification getUpdatedAt après setState
- ServiceTest : ajout testSetStatusSameStatus (branche oldStatus === status,
pas d'ajout dans statusHistory)
- UserExtendedTest : ajout testAvatarFile avec File réel + null (97→98%)
- OrderNumberTest : constructor + markAsUsed (100%)
- AdvertTest : constructor, setDevis/null, verifyHmac valid/invalid (100%)
- FactureTest : constructor, setAdvert/null, splitIndex, getInvoiceNumber
sans/avec split, verifyHmac valid/invalid (100%)
Tests MessageHandlers :
- AppLogMessageHandlerTest (2 tests) : __invoke avec userId (find user + persist
AppLog + flush), __invoke sans userId (userId null, user null)
- MeilisearchSyncMessageHandlerTest (12 tests) : remove customer/revendeur/price/
unknown, index customer trouvé/non trouvé, index revendeur trouvé/non trouvé,
index price trouvé/non trouvé, index unknown type
Tests services :
- OrderNumberServiceTest (5 tests) : generate/preview premier et incrémenté,
generateAndUse
- TarificationServiceTest (9 tests) : ensureDefaultPrices tous/skip/aucun/
avec Meilisearch+Stripe/erreur Stripe, getAll, getByType, getDefaultTypes
- AdvertServiceTest (3 tests) : create sans/avec devis, createFromDevis
- FactureServiceTest (5 tests) : create sans advert, 1re/2e/3e facture, direct
Exclusions services API live :
- phpunit.dist.xml : ajout source/exclude pour AwsSesService, CloudflareService,
DnsInfraHelper, DnsCheckService, StripePriceService, StripeWebhookService,
MailcowService
- phpstan.dist.neon : ajout excludePaths pour les 7 services
- sonar-project.properties : ajout sonar.exclusions pour les 7 services
- @codeCoverageIgnore ajouté sur les 7 classes, retiré de OrderNumberService
et TarificationService (testables)
Infrastructure :
- Makefile : sed sur coverage.xml pour réécrire /app/ en chemins relatifs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:37:37 +02:00
|
|
|
|
test: couverture 83% methodes (1046 tests, 2135 assertions)
Entites completes a 100% :
- AdvertTest : 12 nouveaux (state, customer, totals, hmac, lines, payments)
- CustomerTest : 3 nouveaux (isPendingDelete, revendeurCode, updatedAt)
- DevisTest : 6 nouveaux (customer, submissionId, lines, state constants)
- FactureTest : 10 nouveaux (state, totals, isPaid, lines, hmac, splitIndex)
- OrderNumberTest : 1 nouveau (markAsUnused)
- WebsiteTest : 1 nouveau (revendeurCode)
Services completes/ameliores :
- DocuSealServiceTest : 30 nouveaux (sendDevis, resendDevis, download, compta)
- AdvertServiceTest : 6 nouveaux (isTvaEnabled, getTvaRate, computeTotals)
- DevisServiceTest : 6 nouveaux (idem)
- FactureServiceTest : 8 nouveaux (idem + createPaidFactureFromAdvert)
- MailerServiceTest : 7 nouveaux (unsubscribe headers, VCF, formatFileSize)
- MeilisearchServiceTest : 42 nouveaux (index/remove/search tous types)
- RgpdServiceTest : 6 nouveaux (sendVerificationCode, verifyCode)
- OrderNumberServiceTest : 2 nouveaux (preview/generate unused)
- TarificationServiceTest : 1 nouveau (stripe error logger)
- ComptaPdfTest : 4 nouveaux (totaux, colonnes numeriques, signature)
- FacturePdfTest : 6 nouveaux (QR code, RIB, CGV Twig, footer skip)
Controllers ameliores :
- ComptabiliteControllerTest : 13 nouveaux (JSON, PDF, sign, callback)
- StatsControllerTest : 2 nouveaux (rich data, 6-month evolution)
- SyncControllerTest : 13 nouveaux (sync 6 types + purge)
- ClientsControllerTest : 7 nouveaux (show, delete, resendWelcome)
- FactureControllerTest : 2 nouveaux (generatePdf 404, send success)
- LegalControllerTest : 6 nouveaux (rgpdVerify GET/POST)
- TarificationControllerTest : 3 nouveaux (purge paths)
- AdminControllersTest : 9 nouveaux (dashboard search, services)
- WebhookStripeControllerTest : 3 nouveaux (invalid signatures)
- KeycloakAuthenticatorTest : 4 nouveaux (groups, domain check)
Commands :
- PaymentReminderCommandTest : 1 nouveau (formalNotice step)
- TestMailCommandTest : 2 nouveaux (force-dsn success/failure)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 00:13:00 +02:00
|
|
|
public function testIsPendingDelete(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertFalse($c->isPendingDelete());
|
|
|
|
|
|
|
|
|
|
$c->setState(Customer::STATE_PENDING_DELETE);
|
|
|
|
|
$this->assertTrue($c->isPendingDelete());
|
|
|
|
|
|
|
|
|
|
$c->setState(Customer::STATE_ACTIVE);
|
|
|
|
|
$this->assertFalse($c->isPendingDelete());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testRevendeurCode(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getRevendeurCode());
|
|
|
|
|
|
|
|
|
|
$c->setRevendeurCode('REV01');
|
|
|
|
|
$this->assertSame('REV01', $c->getRevendeurCode());
|
|
|
|
|
|
|
|
|
|
$c->setRevendeurCode(null);
|
|
|
|
|
$this->assertNull($c->getRevendeurCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSetUpdatedAt(): void
|
|
|
|
|
{
|
|
|
|
|
$c = $this->createCustomer();
|
|
|
|
|
$this->assertNull($c->getUpdatedAt());
|
|
|
|
|
|
|
|
|
|
$now = new \DateTimeImmutable();
|
|
|
|
|
$result = $c->setUpdatedAt($now);
|
|
|
|
|
|
|
|
|
|
$this->assertSame($now, $c->getUpdatedAt());
|
|
|
|
|
$this->assertSame($c, $result);
|
|
|
|
|
}
|
test: ajout tests Customer, EmailTracking, MessengerLog, PriceAutomatic
tests/Entity/CustomerTest.php (nouveau, 11 tests):
- testConstructor: id null, user, state active, createdAt, updatedAt null
- testCodeComptable: get/set nullable
- testGenerateCodeComptable: genere un code non vide
- testNames: firstName, lastName, fullName
- testRaisonSociale: get/set
- testContact: email, phone
- testAddress: address, address2, zipCode, city
- testLegal: siret, rcs, numTva
- testStripe: stripeCustomerId get/set nullable
- testTypeCompany: set TYPE_SARL
- testState: setState suspended, isActive false
tests/Entity/EmailTrackingTest.php (nouveau, 4 tests):
- testConstructor: messageId, recipient, subject, htmlBody, attachments,
state='sent', sentAt DateTimeImmutable, openedAt null
- testConstructorWithoutOptionals: htmlBody et attachments null
- testMarkAsOpened: state='opened', openedAt set
- testMarkAsOpenedOnlyOnce: deuxieme appel ne change pas openedAt
tests/Entity/MessengerLogTest.php (nouveau, 4 tests):
- testConstructor: tous les champs avec valeurs, status='failed',
createdAt et failedAt DateTimeImmutable
- testConstructorMinimal: messageBody, stackTrace, transportName null,
retryCount 0
- testSetStatus: change le status
- testMarkAsResolved: status passe a 'resolved'
tests/Entity/PriceAutomaticTest.php (nouveau, 2 tests):
- testGettersSetters: tous les champs avec valeurs
- testNullables: description, stripeId, stripeAbonnementId null
Resultat: 315 tests, 605 assertions, 0 failures
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 00:00:43 +02:00
|
|
|
}
|