Files
e-ticket/tests/Entity/BilletDesignTest.php
Serreau Jovann 179a0703f8 Add Billet entity, BilletDesign, ticket designer, CRUD billets, commissions
- Create Billet entity: name, position, priceHT, quantity (nullable=unlimited),
  isGeneratedBillet, hasDefinedExit, notBuyable, type (billet/reservation_brocante/vote),
  stripeProductId, description, picture (VichUploader), category (ManyToOne CASCADE)
- Create BilletDesign entity (OneToOne Event): accentColor, invitationTitle, invitationColor
- Billet CRUD: add/edit/delete with access control, Stripe product sync on connected account
- Billet reorder: drag & drop with position field, refactored sortable.js for both categories and billets
- Ticket designer tab (custom offer only): accent color, invitation title/color, live iframe preview
- A4 ticket preview: 4 zones (HG infos+billet, HD affiche, BG association, BD sortie+invitation), fake QR code SVG
- Commission calculator JS: live breakdown of E-Ticket fee, Stripe fee (1.5%+0.25EUR), net amount
- Sales recap on categories tab: qty sold, total HT, total commissions, total net
- DisableProfilerSubscriber: disable web profiler toolbar on preview iframe
- CSP: allow self in frame-src and frame-ancestors for preview iframe
- Flysystem: dedicated billets.storage for billet images
- Upload accept restricted to png/jpeg/webp/gif (no HEIC)
- Makefile: add force_sql_dev command
- CLAUDE.md: add rule to never modify existing migrations
- Consolidate all migrations into single Version20260321111125
- Tests: BilletTest (20), BilletDesignTest (6), DisableProfilerSubscriberTest (5),
  billet-designer.test.js (7), commission-calculator.test.js (7),
  AccountControllerTest billet CRUD tests (11)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 12:19:46 +01:00

70 lines
2.0 KiB
PHP

<?php
namespace App\Tests\Entity;
use App\Entity\BilletDesign;
use App\Entity\Event;
use PHPUnit\Framework\TestCase;
class BilletDesignTest extends TestCase
{
public function testDefaults(): void
{
$design = new BilletDesign();
self::assertNull($design->getId());
self::assertNull($design->getEvent());
self::assertSame('#4f46e5', $design->getAccentColor());
self::assertSame('Invitation', $design->getInvitationTitle());
self::assertSame('#d4a017', $design->getInvitationColor());
self::assertInstanceOf(\DateTimeImmutable::class, $design->getUpdatedAt());
}
public function testSetAndGetEvent(): void
{
$design = new BilletDesign();
$event = new Event();
$result = $design->setEvent($event);
self::assertSame($event, $design->getEvent());
self::assertSame($design, $result);
}
public function testSetAndGetAccentColor(): void
{
$design = new BilletDesign();
$result = $design->setAccentColor('#ff0000');
self::assertSame('#ff0000', $design->getAccentColor());
self::assertSame($design, $result);
}
public function testSetAndGetInvitationTitle(): void
{
$design = new BilletDesign();
$result = $design->setInvitationTitle('VIP Pass');
self::assertSame('VIP Pass', $design->getInvitationTitle());
self::assertSame($design, $result);
}
public function testSetAndGetInvitationColor(): void
{
$design = new BilletDesign();
$result = $design->setInvitationColor('#00ff00');
self::assertSame('#00ff00', $design->getInvitationColor());
self::assertSame($design, $result);
}
public function testSetAndGetUpdatedAt(): void
{
$design = new BilletDesign();
$date = new \DateTimeImmutable('2026-01-01');
$result = $design->setUpdatedAt($date);
self::assertSame($date, $design->getUpdatedAt());
self::assertSame($design, $result);
}
}