b2in/tests/Feature/LegalTextUpdateTest.php
Kevin Adametz 07816dce19 Kontaktdaten: Telefon +49 521 986 20 100, E-Mail interior@b2in.eu
Lang-Dateien (Kontaktformular, Impressum, Datenschutz, de/en), Support-Link im Partnerportal,
WhatsApp-Schreibweise und Platzhalter im Admin. ContactDetailsSeeder ersetzt die alten Werte in
den gespeicherten CMS-Einträgen (beide Sprachen), Marken und Magazin; Display-Folien und
Info-Tablet (CABINET-Showroom) bleiben unberührt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:29:34 +00:00

78 lines
3.5 KiB
PHP

<?php
declare(strict_types=1);
use Database\Seeders\LegalTextUpdateSeeder;
use FluxCms\Core\Models\CmsContent;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
/**
* Rechtstexte auf aktuellem Stand (06.10.2026): DDG, MStV, TDDDG, GA4, Leistungsbeschreibung.
*/
it('ships current legal references on every legal page', function (string $path, array $expected) {
$html = $this->get($path)->assertSuccessful()->getContent();
foreach ($expected as $text) {
expect($html)->toContain($text);
}
expect($html)->not->toContain('TMG')
->not->toContain('RStV')
->not->toContain('TTDSG')
->not->toContain('IP-Anonymisierung')
->not->toContain('(WICHTIG!)')
->not->toContain('Lissabon')
->not->toContain('info@b2in.de');
})->with([
'impressum' => ['/impressum', ['§ 5 DDG', '§ 18 Abs. 2 MStV', 'Amtsgericht Bad Oeynhausen', 'Verbraucherstreitbeilegung', 'interior@b2in.eu', '+49 521 986 20 100']],
'terms' => ['/terms', ['Stand: 06.10.2026', 'Unter B2in Interior bieten wir']],
'privacy' => ['/privacy', ['§ 25 Abs. 2 Nr. 2 TDDDG', 'Google Analytics 4', '2. Hosting', 'Hetzner Online GmbH', 'Falkenstein (Sachsen)', 'höchstens 14 Tage gespeichert', 'united-domains GmbH', '9. Ihre Rechte als betroffene Person']],
'cookies' => ['/cookie-policy', ['§ 25 Abs. 1 TDDDG', 'Stand: 06.10.2026']],
]);
it('updates legal texts stored in the CMS and keeps the rest', function () {
$row = CmsContent::create(['group' => 'legal', 'key' => 'impressum', 'type' => 'json', 'order' => 0, 'value' => [
'de' => ['title' => 'Impressum', 'subtitle' => 'Angaben gemäß § 5 TMG', 'content' => '<p>Eigener Absatz. Registergericht: Amtsg. Bad Oeynhausen</p>'],
]]);
$this->seed(LegalTextUpdateSeeder::class);
$this->seed(LegalTextUpdateSeeder::class);
expect($row->refresh()->getTranslation('value', 'de'))->toBe([
'title' => 'Impressum',
'subtitle' => 'Angaben gemäß § 5 DDG',
'content' => '<p>Eigener Absatz. Registergericht: Amtsgericht Bad Oeynhausen</p>',
]);
});
it('adds hosting and mail provider to a stored privacy policy only once', function () {
$row = CmsContent::create(['group' => 'legal', 'key' => 'privacy', 'type' => 'json', 'order' => 0, 'value' => [
'de' => ['content' => '<div>
<h2 class="text-lg font-semibold text-foreground mb-2">2. Datenerfassung auf unserer Website (Server-Log-Dateien)</h2>
<p>Logs.</p>
</div>
<div>
<h2 class="text-lg font-semibold text-foreground mb-2">3. Kontaktformular und E-Mail-Kontakt</h2>
<p>Diese Daten geben wir nicht ohne Ihre Einwilligung weiter.</p>
</div>'],
]]);
$this->seed(LegalTextUpdateSeeder::class);
$this->seed(LegalTextUpdateSeeder::class);
$content = $row->refresh()->getTranslation('value', 'de')['content'];
expect(substr_count($content, '2. Hosting'))->toBe(1)
->and(substr_count($content, 'united-domains GmbH'))->toBe(1)
->and(substr_count($content, 'Falkenstein'))->toBe(1)
->and($content)->toContain('3. Datenerfassung')->toContain('4. Kontaktformular')
->and(substr_count($content, '<div'))->toBe(substr_count($content, '</div>'));
});
it('points the partner portal support link to interior@b2in.eu', function () {
$view = file_get_contents(resource_path('views/partner/invitation-expired.blade.php'));
expect($view)->toContain('mailto:interior@b2in.eu')->not->toContain('@b2in.de');
});