- VatResolver::normalizeCountryCode()/isEuCountry() als Single Source of Truth;
resolve(), VatIdValidationService und StripeCheckoutService nutzen jetzt die
zentrale EU-Pruefung statt eigener config-Lookups.
- User::findByEmail() buendelt die LOWER(email)-Lookups (ContactAccessService,
SocialAuthService). Bleibt bewusst case-insensitiv, da E-Mails nicht
normalisiert gespeichert werden; der indexfreundliche Direktvergleich
braucht erst eine Schreib-Normalisierung (offen, dokumentiert).
- config('billing.default_currency') ersetzt 8 verstreute 'EUR'/'eur'-Literale
(Stripe-Calls via strtolower). Vereinheitlicht nebenbei die zuvor uneinheitlich
gespeicherte SinglePurchase.currency.
- Neuer CustomerAccountProvisioner::provisionVerifiedCustomer() ist die
gemeinsame Provisioning-Methode (verifiziert + aktiv + customer-Rolle) fuer
ContactAccessService und SocialAuthService.
- Tests: UserFindByEmailTest, erweiterte VatResolverTest.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
18 lines
668 B
PHP
18 lines
668 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
|
|
test('findByEmail matches case-insensitively and trims whitespace', function () {
|
|
$user = User::factory()->create(['email' => 'Mixed.Case@Example.com']);
|
|
|
|
expect(User::findByEmail('mixed.case@example.com')?->id)->toBe($user->id)
|
|
->and(User::findByEmail(' MIXED.CASE@EXAMPLE.COM ')?->id)->toBe($user->id);
|
|
});
|
|
|
|
test('findByEmail returns null for blank or unknown email', function () {
|
|
User::factory()->create(['email' => 'someone@example.com']);
|
|
|
|
expect(User::findByEmail(''))->toBeNull()
|
|
->and(User::findByEmail(' '))->toBeNull()
|
|
->and(User::findByEmail('unknown@example.com'))->toBeNull();
|
|
});
|