$email], ['email' => ['nullable', 'email', new PlausibleEmailDomain]])->passes(); } test('addresses without a real domain ending are rejected', function () { /** @var TestCase $this */ // Alle drei stammen aus dem Bestand vom 15.09.2026 und bestehen // Laravels `email`-Regel anstandslos. expect(passesPlausibility('info@hoerwelt-basel'))->toBeFalse() ->and(passesPlausibility('kontakt@hoerex'))->toBeFalse() ->and(passesPlausibility('cks@kaeser-stroebelde'))->toBeFalse() ->and(passesPlausibility('info@urbanbnb.ded'))->toBeFalse(); }); test('ordinary addresses pass, international ones included', function () { /** @var TestCase $this */ expect(passesPlausibility('presse@firma.de'))->toBeTrue() ->and(passesPlausibility('info@sub.firma.co.uk'))->toBeTrue() ->and(passesPlausibility('info@münchen-presse.de'))->toBeTrue() ->and(passesPlausibility('info@xn--mnchen-presse-mfb.de'))->toBeTrue(); }); test('malformed domains are rejected without asking dns', function () { /** @var TestCase $this */ expect(passesPlausibility('info@-firma.de'))->toBeFalse() ->and(passesPlausibility('info@firma-.de'))->toBeFalse() ->and(passesPlausibility('info@firma..de'))->toBeFalse() ->and(passesPlausibility('info@firma.12'))->toBeFalse(); }); test('the domain of an address is returned in dns form', function () { /** @var TestCase $this */ expect(PlausibleEmailDomain::domainOf('Presse@Firma.DE'))->toBe('firma.de') ->and(PlausibleEmailDomain::domainOf('info@münchen.de'))->toBe('xn--mnchen-3ya.de') ->and(PlausibleEmailDomain::domainOf('ohne-at'))->toBeNull() ->and(PlausibleEmailDomain::domainOf(null))->toBeNull(); }); test('the legacy api refuses a company address whose domain cannot exist', function () { /** @var TestCase $this */ Queue::fake(); test()->seed(RolesAndPermissionsSeeder::class); $user = User::factory()->create(['is_active' => true, 'portal' => Portal::Businessportal24]); apiActingAs($user, ['press-releases:write']); $this->postJson('/service/users/me/companies', [ 'company' => ['name' => 'Hörwelt Basel', 'email' => 'info@hoerwelt-basel'], ])->assertStatus(422); $this->postJson('/service/users/me/companies', [ 'company' => ['name' => 'Hörwelt Basel', 'email' => 'info@hoerwelt-basel.ch'], ])->assertCreated(); });