2026-03-18 22:50:23 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\Entity;
|
|
|
|
|
|
|
|
|
|
use App\Entity\User;
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
class UserTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
public function testNewUserHasCreatedAt(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertInstanceOf(\DateTimeImmutable::class, $user->getCreatedAt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetRolesAlwaysIncludesRoleUser(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertContains('ROLE_USER', $user->getRoles());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSetRolesDeduplicatesRoleUser(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->setRoles(['ROLE_ADMIN', 'ROLE_USER']);
|
|
|
|
|
|
|
|
|
|
$roles = $user->getRoles();
|
|
|
|
|
self::assertCount(2, $roles);
|
|
|
|
|
self::assertContains('ROLE_ADMIN', $roles);
|
|
|
|
|
self::assertContains('ROLE_USER', $roles);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testGetUserIdentifierReturnsEmail(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->setEmail('test@example.com');
|
|
|
|
|
|
|
|
|
|
self::assertSame('test@example.com', $user->getUserIdentifier());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testFluentSetters(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
$result = $user->setEmail('a@b.com')
|
|
|
|
|
->setFirstName('John')
|
|
|
|
|
->setLastName('Doe')
|
|
|
|
|
->setPassword('hashed');
|
|
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame('a@b.com', $user->getEmail());
|
|
|
|
|
self::assertSame('John', $user->getFirstName());
|
|
|
|
|
self::assertSame('Doe', $user->getLastName());
|
|
|
|
|
self::assertSame('hashed', $user->getPassword());
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-19 11:40:18 +01:00
|
|
|
public function testOrganizerFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
$result = $user->setCompanyName('Mon Asso')
|
|
|
|
|
->setSiret('12345678901234')
|
|
|
|
|
->setAddress('12 rue de la Paix')
|
|
|
|
|
->setPostalCode('75001')
|
|
|
|
|
->setCity('Paris')
|
|
|
|
|
->setPhone('0612345678');
|
|
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame('Mon Asso', $user->getCompanyName());
|
|
|
|
|
self::assertSame('12345678901234', $user->getSiret());
|
|
|
|
|
self::assertSame('12 rue de la Paix', $user->getAddress());
|
|
|
|
|
self::assertSame('75001', $user->getPostalCode());
|
|
|
|
|
self::assertSame('Paris', $user->getCity());
|
|
|
|
|
self::assertSame('0612345678', $user->getPhone());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testOrganizerFieldsDefaultToNull(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getCompanyName());
|
|
|
|
|
self::assertNull($user->getSiret());
|
|
|
|
|
self::assertNull($user->getAddress());
|
|
|
|
|
self::assertNull($user->getPostalCode());
|
|
|
|
|
self::assertNull($user->getCity());
|
|
|
|
|
self::assertNull($user->getPhone());
|
|
|
|
|
}
|
|
|
|
|
|
Add organizer logo upload, Meilisearch organizer search, and webp URL rewriting
VichUploader organizer logo:
- Add organizer_logo mapping with local Flysystem storage
- Add logoFile, logoName, updatedAt fields to User entity
- Use Vich Attribute (not deprecated Annotation)
- Add migration for logo_name and updated_at columns
Meilisearch organizer search:
- Add search bar on /admin/organisateurs page (hides tabs during search)
- Index organizers in Meilisearch on approval
- Sync button on dashboard now syncs both buyers and organizers
- Add tests: search query, search error
Liip Imagine webp:
- Add format filter to all filter_sets for explicit webp conversion
- Add organizer_logo filter_set (400x400, webp)
- Create WebpExtensionSubscriber to rewrite image URLs to .webp extension
- 8 tests for subscriber (png, jpg, jpeg, gif, webp passthrough, case insensitive, null)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 18:46:34 +01:00
|
|
|
public function testLogoFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getLogoFile());
|
|
|
|
|
self::assertNull($user->getLogoName());
|
|
|
|
|
self::assertNull($user->getUpdatedAt());
|
|
|
|
|
|
|
|
|
|
$result = $user->setLogoName('logo.png');
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame('logo.png', $user->getLogoName());
|
|
|
|
|
|
|
|
|
|
$file = new \Symfony\Component\HttpFoundation\File\File(__FILE__);
|
|
|
|
|
$result = $user->setLogoFile($file);
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame($file, $user->getLogoFile());
|
|
|
|
|
self::assertNotNull($user->getUpdatedAt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSetLogoFileNullDoesNotUpdateTimestamp(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->setLogoFile(null);
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getUpdatedAt());
|
|
|
|
|
}
|
|
|
|
|
|
Add email verification, organizer approval, and forgot password features
- Add isVerified, emailVerificationToken, emailVerifiedAt fields to User entity
- Send verification email on registration with token link
- Add /verification-email/{token} route to confirm email
- Send notification emails to organizer and staff on organizer email verification
- Add isApproved and offer fields to User entity for organizer approval workflow
- Auto-verify and auto-approve SSO Keycloak users with offer='custom'
- Add resetCode and resetCodeExpiresAt fields to User entity
- Create ForgotPasswordController with 2-step flow (email -> code + new password)
- Block forgot password for SSO users (no local password)
- Add "Mot de passe oublie" link on login page
- Create email templates: verification, reset_code, organizer_pending, organizer_request
- Add migrations for all new fields
- Add tests: ForgotPasswordControllerTest (9 tests), update RegistrationControllerTest,
update UserTest with verification, approval, offer, and reset code fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:13:32 +01:00
|
|
|
public function testResetCodeFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getResetCode());
|
|
|
|
|
self::assertNull($user->getResetCodeExpiresAt());
|
|
|
|
|
|
|
|
|
|
$expiry = new \DateTimeImmutable('+15 minutes');
|
|
|
|
|
$result = $user->setResetCode('123456')->setResetCodeExpiresAt($expiry);
|
|
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame('123456', $user->getResetCode());
|
|
|
|
|
self::assertSame($expiry, $user->getResetCodeExpiresAt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testApprovalAndOfferFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertFalse($user->isApproved());
|
|
|
|
|
self::assertNull($user->getOffer());
|
Add SIRET/RNA verification, organizer management, registration flow pages
SIRET/RNA verification:
- Create SiretService with API gouv lookup + JOAFE RNA lookup + cache pool (24h)
- Verification page: declared info vs API data side by side
- Display NAF code + label (from naf.json), nature juridique code + label
- Association/Entreprise/EI badges, ESS badge, RNA, coordonnees lat/long
- JOAFE section: objet, regime, domaine, dates, lieu, PDF download link
- Tranche effectif with readable labels
- Refresh cache button
- Page restricted to non-approved organizers only
Organizer approval flow:
- Approval form with offer (free/basic/custom) and commission rate (default 3%)
- Add commissionRate field to User entity + migration
- Rejection form with required reason textarea, sent in email
- Edit page for approved organizers: all fields modifiable
- Modify button in approved organizers table
Registration flow pages:
- Post-registration success page with email verification message
- Organizer gets additional 48h staff review notice
- Post-email-verification page: confirmed for buyers, 48h notice for organizers
Dashboard:
- Simplified Meilisearch sync to single button
Tests: SiretServiceTest (9), AdminControllerTest (31), RegistrationControllerTest updated, UserTest updated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:25:04 +01:00
|
|
|
self::assertNull($user->getCommissionRate());
|
Add email verification, organizer approval, and forgot password features
- Add isVerified, emailVerificationToken, emailVerifiedAt fields to User entity
- Send verification email on registration with token link
- Add /verification-email/{token} route to confirm email
- Send notification emails to organizer and staff on organizer email verification
- Add isApproved and offer fields to User entity for organizer approval workflow
- Auto-verify and auto-approve SSO Keycloak users with offer='custom'
- Add resetCode and resetCodeExpiresAt fields to User entity
- Create ForgotPasswordController with 2-step flow (email -> code + new password)
- Block forgot password for SSO users (no local password)
- Add "Mot de passe oublie" link on login page
- Create email templates: verification, reset_code, organizer_pending, organizer_request
- Add migrations for all new fields
- Add tests: ForgotPasswordControllerTest (9 tests), update RegistrationControllerTest,
update UserTest with verification, approval, offer, and reset code fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:13:32 +01:00
|
|
|
|
Add SIRET/RNA verification, organizer management, registration flow pages
SIRET/RNA verification:
- Create SiretService with API gouv lookup + JOAFE RNA lookup + cache pool (24h)
- Verification page: declared info vs API data side by side
- Display NAF code + label (from naf.json), nature juridique code + label
- Association/Entreprise/EI badges, ESS badge, RNA, coordonnees lat/long
- JOAFE section: objet, regime, domaine, dates, lieu, PDF download link
- Tranche effectif with readable labels
- Refresh cache button
- Page restricted to non-approved organizers only
Organizer approval flow:
- Approval form with offer (free/basic/custom) and commission rate (default 3%)
- Add commissionRate field to User entity + migration
- Rejection form with required reason textarea, sent in email
- Edit page for approved organizers: all fields modifiable
- Modify button in approved organizers table
Registration flow pages:
- Post-registration success page with email verification message
- Organizer gets additional 48h staff review notice
- Post-email-verification page: confirmed for buyers, 48h notice for organizers
Dashboard:
- Simplified Meilisearch sync to single button
Tests: SiretServiceTest (9), AdminControllerTest (31), RegistrationControllerTest updated, UserTest updated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:25:04 +01:00
|
|
|
$result = $user->setIsApproved(true)->setOffer('custom')->setCommissionRate(1.5);
|
Add email verification, organizer approval, and forgot password features
- Add isVerified, emailVerificationToken, emailVerifiedAt fields to User entity
- Send verification email on registration with token link
- Add /verification-email/{token} route to confirm email
- Send notification emails to organizer and staff on organizer email verification
- Add isApproved and offer fields to User entity for organizer approval workflow
- Auto-verify and auto-approve SSO Keycloak users with offer='custom'
- Add resetCode and resetCodeExpiresAt fields to User entity
- Create ForgotPasswordController with 2-step flow (email -> code + new password)
- Block forgot password for SSO users (no local password)
- Add "Mot de passe oublie" link on login page
- Create email templates: verification, reset_code, organizer_pending, organizer_request
- Add migrations for all new fields
- Add tests: ForgotPasswordControllerTest (9 tests), update RegistrationControllerTest,
update UserTest with verification, approval, offer, and reset code fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:13:32 +01:00
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertTrue($user->isApproved());
|
|
|
|
|
self::assertSame('custom', $user->getOffer());
|
Add SIRET/RNA verification, organizer management, registration flow pages
SIRET/RNA verification:
- Create SiretService with API gouv lookup + JOAFE RNA lookup + cache pool (24h)
- Verification page: declared info vs API data side by side
- Display NAF code + label (from naf.json), nature juridique code + label
- Association/Entreprise/EI badges, ESS badge, RNA, coordonnees lat/long
- JOAFE section: objet, regime, domaine, dates, lieu, PDF download link
- Tranche effectif with readable labels
- Refresh cache button
- Page restricted to non-approved organizers only
Organizer approval flow:
- Approval form with offer (free/basic/custom) and commission rate (default 3%)
- Add commissionRate field to User entity + migration
- Rejection form with required reason textarea, sent in email
- Edit page for approved organizers: all fields modifiable
- Modify button in approved organizers table
Registration flow pages:
- Post-registration success page with email verification message
- Organizer gets additional 48h staff review notice
- Post-email-verification page: confirmed for buyers, 48h notice for organizers
Dashboard:
- Simplified Meilisearch sync to single button
Tests: SiretServiceTest (9), AdminControllerTest (31), RegistrationControllerTest updated, UserTest updated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:25:04 +01:00
|
|
|
self::assertSame(1.5, $user->getCommissionRate());
|
Add email verification, organizer approval, and forgot password features
- Add isVerified, emailVerificationToken, emailVerifiedAt fields to User entity
- Send verification email on registration with token link
- Add /verification-email/{token} route to confirm email
- Send notification emails to organizer and staff on organizer email verification
- Add isApproved and offer fields to User entity for organizer approval workflow
- Auto-verify and auto-approve SSO Keycloak users with offer='custom'
- Add resetCode and resetCodeExpiresAt fields to User entity
- Create ForgotPasswordController with 2-step flow (email -> code + new password)
- Block forgot password for SSO users (no local password)
- Add "Mot de passe oublie" link on login page
- Create email templates: verification, reset_code, organizer_pending, organizer_request
- Add migrations for all new fields
- Add tests: ForgotPasswordControllerTest (9 tests), update RegistrationControllerTest,
update UserTest with verification, approval, offer, and reset code fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:13:32 +01:00
|
|
|
}
|
|
|
|
|
|
Add payouts, PDF attestations, sub-accounts, and webhook improvements
Payout system:
- Create Payout entity (stripePayoutId, status, amount, currency, destination, arrivalDate)
- Webhook handles payout.created/updated/paid/failed/canceled with email notification
- Payout list in /mon-compte virements tab with status badges
- PDF attestation on paid payouts with email attachment
PDF attestation:
- dompdf with DejaVu Sans font, yellow-orange gradient background
- Orange centered title bar, E-Cosplay logo, emitter/beneficiary info blocks
- QR code linking to /attestation/check/{payoutId} for authenticity verification
- Public verification page: shows payout details if valid, error if altered
- Legal disclaimer and CGV reference
- Button visible only when status is paid, opens in new tab
Sub-accounts:
- Add parentOrganizer (self-referencing ManyToOne) and subAccountPermissions (JSON) to User
- Permissions: scanner (validate tickets), events (CRUD), tickets (free invitations)
- Create sub-account with random password, send email with credentials
- Edit page with name/email/permissions checkboxes
- Delete with confirmation
- hasPermission() helper method
Account improvements:
- Block entire page for unapproved organizers with validation pending message
- Display stripeStatus in Stripe Connect banners
- Remove test payout button
Webhook v2 Connect events:
- v2.core.account.created/updated/closed → update stripeStatus
- capability_status_updated → sync charges/payouts enabled from capabilities
- PayoutPdfService for reusable PDF generation
Migrations: stripeStatus, Payout table, sub-account fields, drop pdfPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:49:48 +01:00
|
|
|
public function testSubAccountFields(): void
|
|
|
|
|
{
|
|
|
|
|
$parent = new User();
|
|
|
|
|
$sub = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($sub->getParentOrganizer());
|
|
|
|
|
self::assertNull($sub->getSubAccountPermissions());
|
|
|
|
|
self::assertFalse($sub->hasPermission('scanner'));
|
|
|
|
|
|
|
|
|
|
$result = $sub->setParentOrganizer($parent)
|
|
|
|
|
->setSubAccountPermissions(['scanner', 'events']);
|
|
|
|
|
|
|
|
|
|
self::assertSame($sub, $result);
|
|
|
|
|
self::assertSame($parent, $sub->getParentOrganizer());
|
|
|
|
|
self::assertSame(['scanner', 'events'], $sub->getSubAccountPermissions());
|
|
|
|
|
self::assertTrue($sub->hasPermission('scanner'));
|
|
|
|
|
self::assertTrue($sub->hasPermission('events'));
|
|
|
|
|
self::assertFalse($sub->hasPermission('tickets'));
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-19 20:46:55 +01:00
|
|
|
public function testStripeFields(): void
|
2026-03-19 20:37:16 +01:00
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getStripeAccountId());
|
Add payouts, PDF attestations, sub-accounts, and webhook improvements
Payout system:
- Create Payout entity (stripePayoutId, status, amount, currency, destination, arrivalDate)
- Webhook handles payout.created/updated/paid/failed/canceled with email notification
- Payout list in /mon-compte virements tab with status badges
- PDF attestation on paid payouts with email attachment
PDF attestation:
- dompdf with DejaVu Sans font, yellow-orange gradient background
- Orange centered title bar, E-Cosplay logo, emitter/beneficiary info blocks
- QR code linking to /attestation/check/{payoutId} for authenticity verification
- Public verification page: shows payout details if valid, error if altered
- Legal disclaimer and CGV reference
- Button visible only when status is paid, opens in new tab
Sub-accounts:
- Add parentOrganizer (self-referencing ManyToOne) and subAccountPermissions (JSON) to User
- Permissions: scanner (validate tickets), events (CRUD), tickets (free invitations)
- Create sub-account with random password, send email with credentials
- Edit page with name/email/permissions checkboxes
- Delete with confirmation
- hasPermission() helper method
Account improvements:
- Block entire page for unapproved organizers with validation pending message
- Display stripeStatus in Stripe Connect banners
- Remove test payout button
Webhook v2 Connect events:
- v2.core.account.created/updated/closed → update stripeStatus
- capability_status_updated → sync charges/payouts enabled from capabilities
- PayoutPdfService for reusable PDF generation
Migrations: stripeStatus, Payout table, sub-account fields, drop pdfPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:49:48 +01:00
|
|
|
self::assertNull($user->getStripeStatus());
|
2026-03-19 20:46:55 +01:00
|
|
|
self::assertFalse($user->isStripeChargesEnabled());
|
|
|
|
|
self::assertFalse($user->isStripePayoutsEnabled());
|
|
|
|
|
|
|
|
|
|
$result = $user->setStripeAccountId('acct_1234567890')
|
Add payouts, PDF attestations, sub-accounts, and webhook improvements
Payout system:
- Create Payout entity (stripePayoutId, status, amount, currency, destination, arrivalDate)
- Webhook handles payout.created/updated/paid/failed/canceled with email notification
- Payout list in /mon-compte virements tab with status badges
- PDF attestation on paid payouts with email attachment
PDF attestation:
- dompdf with DejaVu Sans font, yellow-orange gradient background
- Orange centered title bar, E-Cosplay logo, emitter/beneficiary info blocks
- QR code linking to /attestation/check/{payoutId} for authenticity verification
- Public verification page: shows payout details if valid, error if altered
- Legal disclaimer and CGV reference
- Button visible only when status is paid, opens in new tab
Sub-accounts:
- Add parentOrganizer (self-referencing ManyToOne) and subAccountPermissions (JSON) to User
- Permissions: scanner (validate tickets), events (CRUD), tickets (free invitations)
- Create sub-account with random password, send email with credentials
- Edit page with name/email/permissions checkboxes
- Delete with confirmation
- hasPermission() helper method
Account improvements:
- Block entire page for unapproved organizers with validation pending message
- Display stripeStatus in Stripe Connect banners
- Remove test payout button
Webhook v2 Connect events:
- v2.core.account.created/updated/closed → update stripeStatus
- capability_status_updated → sync charges/payouts enabled from capabilities
- PayoutPdfService for reusable PDF generation
Migrations: stripeStatus, Payout table, sub-account fields, drop pdfPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:49:48 +01:00
|
|
|
->setStripeStatus('started')
|
2026-03-19 20:46:55 +01:00
|
|
|
->setStripeChargesEnabled(true)
|
|
|
|
|
->setStripePayoutsEnabled(true);
|
2026-03-19 20:37:16 +01:00
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertSame('acct_1234567890', $user->getStripeAccountId());
|
Add payouts, PDF attestations, sub-accounts, and webhook improvements
Payout system:
- Create Payout entity (stripePayoutId, status, amount, currency, destination, arrivalDate)
- Webhook handles payout.created/updated/paid/failed/canceled with email notification
- Payout list in /mon-compte virements tab with status badges
- PDF attestation on paid payouts with email attachment
PDF attestation:
- dompdf with DejaVu Sans font, yellow-orange gradient background
- Orange centered title bar, E-Cosplay logo, emitter/beneficiary info blocks
- QR code linking to /attestation/check/{payoutId} for authenticity verification
- Public verification page: shows payout details if valid, error if altered
- Legal disclaimer and CGV reference
- Button visible only when status is paid, opens in new tab
Sub-accounts:
- Add parentOrganizer (self-referencing ManyToOne) and subAccountPermissions (JSON) to User
- Permissions: scanner (validate tickets), events (CRUD), tickets (free invitations)
- Create sub-account with random password, send email with credentials
- Edit page with name/email/permissions checkboxes
- Delete with confirmation
- hasPermission() helper method
Account improvements:
- Block entire page for unapproved organizers with validation pending message
- Display stripeStatus in Stripe Connect banners
- Remove test payout button
Webhook v2 Connect events:
- v2.core.account.created/updated/closed → update stripeStatus
- capability_status_updated → sync charges/payouts enabled from capabilities
- PayoutPdfService for reusable PDF generation
Migrations: stripeStatus, Payout table, sub-account fields, drop pdfPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:49:48 +01:00
|
|
|
self::assertSame('started', $user->getStripeStatus());
|
2026-03-19 20:46:55 +01:00
|
|
|
self::assertTrue($user->isStripeChargesEnabled());
|
|
|
|
|
self::assertTrue($user->isStripePayoutsEnabled());
|
2026-03-19 20:37:16 +01:00
|
|
|
}
|
|
|
|
|
|
Add email verification, organizer approval, and forgot password features
- Add isVerified, emailVerificationToken, emailVerifiedAt fields to User entity
- Send verification email on registration with token link
- Add /verification-email/{token} route to confirm email
- Send notification emails to organizer and staff on organizer email verification
- Add isApproved and offer fields to User entity for organizer approval workflow
- Auto-verify and auto-approve SSO Keycloak users with offer='custom'
- Add resetCode and resetCodeExpiresAt fields to User entity
- Create ForgotPasswordController with 2-step flow (email -> code + new password)
- Block forgot password for SSO users (no local password)
- Add "Mot de passe oublie" link on login page
- Create email templates: verification, reset_code, organizer_pending, organizer_request
- Add migrations for all new fields
- Add tests: ForgotPasswordControllerTest (9 tests), update RegistrationControllerTest,
update UserTest with verification, approval, offer, and reset code fields
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:13:32 +01:00
|
|
|
public function testEmailVerificationFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertFalse($user->isVerified());
|
|
|
|
|
self::assertNull($user->getEmailVerificationToken());
|
|
|
|
|
self::assertNull($user->getEmailVerifiedAt());
|
|
|
|
|
|
|
|
|
|
$now = new \DateTimeImmutable();
|
|
|
|
|
$result = $user->setIsVerified(true)
|
|
|
|
|
->setEmailVerificationToken('abc123')
|
|
|
|
|
->setEmailVerifiedAt($now);
|
|
|
|
|
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertTrue($user->isVerified());
|
|
|
|
|
self::assertSame('abc123', $user->getEmailVerificationToken());
|
|
|
|
|
self::assertSame($now, $user->getEmailVerifiedAt());
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-18 22:50:23 +01:00
|
|
|
public function testEraseCredentialsDoesNotThrow(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->eraseCredentials();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->getId());
|
|
|
|
|
}
|
Complete TASK_CHECKUP: security, UX, tests, coverage, accessibility, config externalization
Billetterie:
- Partial refund support (STATUS_PARTIALLY_REFUNDED, refundedAmount field, migration)
- Race condition fix: PESSIMISTIC_WRITE lock on stock decrement in transaction
- Idempotency key on PaymentIntent::create, reuse existing PI if stripeSessionId set
- Disable checkout when event ended (server 400 + template hide)
- Webhook deduplication via cache (24h TTL on stripe event.id)
- Email validation (filter_var) in OrderController guest flow
- JSON cart validation (structure check before processing)
- Invitation expiration after 7 days (isExpired method + landing page message)
- Stripe Checkout fallback when JS fails to load (noscript + redirect)
Config externalization:
- Move Stripe fees (STRIPE_FEE_RATE, STRIPE_FEE_FIXED) and admin email (ADMIN_EMAIL) to .env/services.yaml
- Replace all hardcoded contact@e-cosplay.fr across 13 files
- MailerService: getAdminEmail()/getAdminFrom(), default $from=null resolves to admin
UX & Accessibility:
- ARIA tabs: role=tablist/tab/tabpanel, aria-selected, keyboard nav (arrows, Home, End)
- aria-label on cart +/- buttons and editor toolbar buttons
- tabindex=0 on editor toolbar buttons for keyboard access
- data-confirm handler in app.js (was only in admin.js)
- Cart error feedback on checkout failure
- Billet designer save feedback (loading/success/error states)
- Stock polling every 30s with rupture/low stock badges
- Back to event link on payment page
Security:
- HTML sanitizer: BLOCKED_TAGS list (script, style, iframe, svg, etc.) - content fully removed
- Stripe polling timeout (15s max) with fallback redirect
- Rate limiting on public order access (20/5min)
- .catch() on all fetch() calls (sortable, billet-designer)
Tests (92% PHP, 100% JS lines):
- PCOV added to dev Dockerfile
- Test DB setup: .env.test with DATABASE_URL, Redis auth, Meilisearch key
- Rate limiter disabled in test env
- Makefile: test_db_setup, test_db_reset, run_test_php, run_test_coverage_php/js
- New tests: InvitationFlowTest (21), AuditServiceTest (4), ExportServiceTest (9), InvoiceServiceTest (4)
- New tests: SuspendedUserSubscriberTest, RateLimiterSubscriberTest, MeilisearchServiceTest
- New tests: Stripe webhook payment_failed (6) + charge.refunded (6)
- New tests: BilletBuyer refund, User suspended, OrganizerInvitation expiration
- JS tests: stock polling (6), data-confirm (2), copy-url restore (1), editor ARIA (2), XSS (9), tabs keyboard (9)
- ESLint + PHP CS Fixer: 0 errors
- SonarQube exclusions aligned with vitest coverage config
Infra:
- Meilisearch consistency command (app:meilisearch:check-consistency --fix) + cron daily 3am
- MeilisearchService: getAllDocumentIds(), listIndexes()
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 11:14:06 +01:00
|
|
|
|
|
|
|
|
public function testSuspendedFields(): void
|
|
|
|
|
{
|
|
|
|
|
$user = new User();
|
|
|
|
|
|
|
|
|
|
self::assertNull($user->isSuspended());
|
|
|
|
|
|
|
|
|
|
$result = $user->setIsSuspended(true);
|
|
|
|
|
self::assertSame($user, $result);
|
|
|
|
|
self::assertTrue($user->isSuspended());
|
|
|
|
|
|
|
|
|
|
$user->setIsSuspended(false);
|
|
|
|
|
self::assertFalse($user->isSuspended());
|
|
|
|
|
|
|
|
|
|
$user->setIsSuspended(null);
|
|
|
|
|
self::assertNull($user->isSuspended());
|
|
|
|
|
}
|
2026-03-18 22:50:23 +01:00
|
|
|
}
|