Files
crm_ecosplay/tests/Entity/PriceAutomaticTest.php
Serreau Jovann 48dd36e1ae 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

45 lines
1.4 KiB
PHP

<?php
namespace App\Tests\Entity;
use App\Entity\PriceAutomatic;
use PHPUnit\Framework\TestCase;
class PriceAutomaticTest extends TestCase
{
public function testGettersSetters(): void
{
$p = new PriceAutomatic();
$p->setType('esyweb_business');
$p->setTitle('Esy-Web Business');
$p->setDescription('Test description');
$p->setPriceHt('500.00');
$p->setMonthPrice('100.00');
$p->setPeriod(1);
$p->setStripeId('price_xxx');
$p->setStripeAbonnementId('price_yyy');
$this->assertNull($p->getId());
$this->assertSame('esyweb_business', $p->getType());
$this->assertSame('Esy-Web Business', $p->getTitle());
$this->assertSame('Test description', $p->getDescription());
$this->assertSame('500.00', $p->getPriceHt());
$this->assertSame('100.00', $p->getMonthPrice());
$this->assertSame(1, $p->getPeriod());
$this->assertSame('price_xxx', $p->getStripeId());
$this->assertSame('price_yyy', $p->getStripeAbonnementId());
}
public function testNullables(): void
{
$p = new PriceAutomatic();
$p->setType('test');
$p->setTitle('Test');
$p->setPriceHt('0.00');
$this->assertNull($p->getDescription());
$this->assertNull($p->getStripeId());
$this->assertNull($p->getStripeAbonnementId());
}
}