b2in/tests/Feature/ContactDetailsTest.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

48 lines
2.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Database\Seeders\ContactDetailsSeeder;
use FluxCms\Core\Models\CmsContent;
/**
* Neue Kontaktdaten (09.10.2026): +49 521 986 20 100 und interior@b2in.eu.
*/
it('replaces the old phone number and email in stored cms entries, including legal texts and whatsapp', function () {
$legal = CmsContent::create(['group' => 'legal', 'key' => 'impressum', 'type' => 'json', 'order' => 0, 'value' => [
'de' => ['content' => 'E-Mail: <a href="mailto:info@b2in.eu">info@b2in.eu</a><br>Telefon: +49 (0) 5221 9255055'],
'en' => ['content' => 'Email: info@b2in.de, Phone: +49 (0) 5221 9255055'],
]]);
$contact = CmsContent::create(['group' => 'global', 'key' => 'contact', 'type' => 'json', 'order' => 0, 'value' => [
'de' => ['whatsapp' => '+49 521 98620100', 'note' => 'Rufen Sie 0521 98620100 an'],
]]);
$this->seed(ContactDetailsSeeder::class);
$first = [$legal->refresh()->getTranslations('value'), $contact->refresh()->getTranslations('value')];
$this->seed(ContactDetailsSeeder::class);
expect([$legal->refresh()->getTranslations('value'), $contact->refresh()->getTranslations('value')])->toBe($first)
->and($first[0]['de']['content'])->toBe('E-Mail: <a href="mailto:interior@b2in.eu">interior@b2in.eu</a><br>Telefon: +49 521 986 20 100')
->and($first[0]['en']['content'])->toBe('Email: interior@b2in.eu, Phone: +49 521 986 20 100')
->and($first[1]['de']['whatsapp'])->toBe('+49 521 986 20 100')
// Fließtext mit der Nummer bleibt – ersetzt wird nur der vollständige Wert.
->and($first[1]['de']['note'])->toBe('Rufen Sie 0521 98620100 an');
expect(whatsapp_link())->toBe('https://wa.me/4952198620100');
});
it('shows the new contact details on the contact page and in the legal texts', function () {
$this->get('/contact')->assertSuccessful()
->assertSee('interior@b2in.eu')->assertSee('+49 521 986 20 100')
->assertDontSee('5221 9255055')->assertDontSee('info@b2in.eu');
$this->get('/impressum')->assertSuccessful()->assertSee('interior@b2in.eu')->assertSee('+49 521 986 20 100');
$this->get('/privacy')->assertSuccessful()->assertDontSee('info@b2in.eu');
});
it('leaves no old contact details in the default texts', function () {
foreach (['de', 'en'] as $locale) {
foreach (['b2in.php', 'b2in_legal.php'] as $file) {
$text = file_get_contents(lang_path("{$locale}/{$file}"));
expect($text)->not->toContain('5221 9255055')->not->toContain('info@b2in.');
}
}
});