- 83 Komponenten: Livewire\Volt\Component → Livewire\Component
- 73 Routen (admin, auth, customer): Volt::route() → Route::livewire()
- 88 Testdateien: Volt::test/actingAs → Livewire::test/actingAs
- VoltServiceProvider gelöscht; composer remove livewire/volt
- config/livewire.php auf v4-Schlüssel (component_layout, component_placeholder,
component_locations, make_command: SFC ohne ⚡). Der alte Schlüssel layout war
wirkungslos; alle gerouteten Komponenten setzen ihr Layout selbst.
- CLAUDE.md, AGENTS.md, boost.json, .cursorrules, Skill volt-development
- Roadmap: erledigt; Larastan erfasst SFCs weiterhin nicht (Blade-Dateien)
Suite 2.325 grün, einer übersprungen; Larastan und Pint ohne Meldung;
route:cache und view:cache laufen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
139 lines
4.8 KiB
PHP
139 lines
4.8 KiB
PHP
<?php
|
|
|
|
use App\Models\Category;
|
|
use App\Models\Company;
|
|
use App\Models\Contact;
|
|
use App\Models\PressRelease;
|
|
use App\Models\User;
|
|
use Database\Seeders\RolesAndPermissionsSeeder;
|
|
use Illuminate\Support\Carbon;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
beforeEach(function (): void {
|
|
/** @var TestCase $this */
|
|
$this->seed(RolesAndPermissionsSeeder::class);
|
|
});
|
|
|
|
function makeSchedulingCustomer(): array
|
|
{
|
|
$customer = User::factory()->create(['is_active' => true]);
|
|
$customer->assignRole('customer');
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
$contact = Contact::factory()->for($company)->create([
|
|
'portal' => $company->portal->value,
|
|
]);
|
|
$category = Category::factory()->create();
|
|
|
|
return compact('customer', 'company', 'contact', 'category');
|
|
}
|
|
|
|
test('create form persistiert scheduled_at aus datum und uhrzeit ohne embargo', function () {
|
|
/** @var TestCase $this */
|
|
Carbon::setTestNow('2026-06-01 10:00:00');
|
|
|
|
['customer' => $customer, 'category' => $category] = makeSchedulingCustomer();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('title', 'Phase 7F Scheduling Demo')
|
|
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
|
->set('categoryId', $category->id)
|
|
->set('publishMode', 'scheduled')
|
|
->set('scheduledDate', '2026-06-05')
|
|
->set('scheduledTime', '14:30')
|
|
->set('useEmbargo', true)
|
|
->set('embargoAt', '2026-06-10T08:00')
|
|
->call('save')
|
|
->assertHasNoErrors();
|
|
|
|
$pr = PressRelease::query()->latest('id')->firstOrFail();
|
|
|
|
// Die App läuft in Europe/Berlin; die Eingabe 14:30 wird ohne Umrechnung
|
|
// als 14:30 gespeichert.
|
|
expect($pr->scheduled_at?->toDateTimeString())->toBe('2026-06-05 14:30:00');
|
|
expect($pr->embargo_at)->toBeNull();
|
|
});
|
|
|
|
test('create form lehnt scheduled_at in der Vergangenheit ab', function () {
|
|
/** @var TestCase $this */
|
|
Carbon::setTestNow('2026-06-01 10:00:00');
|
|
|
|
['customer' => $customer, 'category' => $category] = makeSchedulingCustomer();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('title', 'Vergangene Veröffentlichung')
|
|
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
|
->set('categoryId', $category->id)
|
|
->set('publishMode', 'scheduled')
|
|
->set('scheduledAt', '2026-05-30T10:00')
|
|
->call('save')
|
|
->assertHasErrors(['scheduledAt']);
|
|
});
|
|
|
|
test('create form lehnt geplanten termin aus datum und uhrzeit in der vergangenheit ab', function () {
|
|
/** @var TestCase $this */
|
|
Carbon::setTestNow('2026-06-01 10:00:00');
|
|
|
|
['customer' => $customer, 'category' => $category] = makeSchedulingCustomer();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('publishMode', 'scheduled')
|
|
->set('scheduledDate', '2026-05-30')
|
|
->set('scheduledTime', '10:00')
|
|
->call('save')
|
|
->assertHasErrors(['scheduledAt']);
|
|
});
|
|
|
|
test('publishMode now setzt scheduled_at auf null beim Save', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'category' => $category] = makeSchedulingCustomer();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('title', 'Sofort veröffentlichen')
|
|
->set('text', str_repeat('Inhalt eines Tests. ', 5))
|
|
->set('categoryId', $category->id)
|
|
->set('publishMode', 'now')
|
|
->set('scheduledAt', '2026-12-31T12:00')
|
|
->call('save')
|
|
->assertHasNoErrors();
|
|
|
|
$pr = PressRelease::query()->latest('id')->firstOrFail();
|
|
|
|
expect($pr->scheduled_at)->toBeNull();
|
|
});
|
|
|
|
test('edit form hydriert scheduled_at in datum und uhrzeit ohne embargo', function () {
|
|
/** @var TestCase $this */
|
|
Carbon::setTestNow('2026-06-01 10:00:00');
|
|
|
|
['customer' => $customer, 'company' => $company, 'contact' => $contact, 'category' => $category] = makeSchedulingCustomer();
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'category_id' => $category->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => 'draft',
|
|
// Wert wird unverändert (Europe/Berlin) in den Eingabefeldern angezeigt.
|
|
'scheduled_at' => '2026-06-05 14:30:00',
|
|
'embargo_at' => '2026-06-10 08:00:00',
|
|
]);
|
|
$pr->contacts()->sync([$contact->id]);
|
|
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.edit', ['id' => $pr->id])
|
|
->assertSet('publishMode', 'scheduled')
|
|
->assertSet('scheduledAt', '2026-06-05T14:30')
|
|
->assertSet('scheduledDate', '2026-06-05')
|
|
->assertSet('scheduledTime', '14:30')
|
|
->assertSet('useEmbargo', false)
|
|
->assertSet('embargoAt', null);
|
|
});
|