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>
49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
use App\Entity\MessengerLog;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class MessengerLogTest extends TestCase
|
|
{
|
|
public function testConstructor(): void
|
|
{
|
|
$log = new MessengerLog('App\Message\TestMessage', '{"data":"test"}', 'Error occurred', 'stack trace', 'async', 2);
|
|
$this->assertNull($log->getId());
|
|
$this->assertSame('App\Message\TestMessage', $log->getMessageClass());
|
|
$this->assertSame('{"data":"test"}', $log->getMessageBody());
|
|
$this->assertSame('failed', $log->getStatus());
|
|
$this->assertSame('Error occurred', $log->getErrorMessage());
|
|
$this->assertSame('stack trace', $log->getStackTrace());
|
|
$this->assertSame('async', $log->getTransportName());
|
|
$this->assertSame(2, $log->getRetryCount());
|
|
$this->assertInstanceOf(\DateTimeImmutable::class, $log->getCreatedAt());
|
|
$this->assertInstanceOf(\DateTimeImmutable::class, $log->getFailedAt());
|
|
}
|
|
|
|
public function testConstructorMinimal(): void
|
|
{
|
|
$log = new MessengerLog('App\Message\Test', null, 'Error');
|
|
$this->assertNull($log->getMessageBody());
|
|
$this->assertNull($log->getStackTrace());
|
|
$this->assertNull($log->getTransportName());
|
|
$this->assertSame(0, $log->getRetryCount());
|
|
}
|
|
|
|
public function testSetStatus(): void
|
|
{
|
|
$log = new MessengerLog('App\Message\Test', null, 'Error');
|
|
$this->assertSame('failed', $log->getStatus());
|
|
$log->setStatus('resolved');
|
|
$this->assertSame('resolved', $log->getStatus());
|
|
}
|
|
|
|
public function testMarkAsResolved(): void
|
|
{
|
|
$log = new MessengerLog('App\Message\Test', null, 'Error');
|
|
$log->markAsResolved();
|
|
$this->assertSame('resolved', $log->getStatus());
|
|
}
|
|
}
|