Kanalkonfigurator: bestätigter Modellwechsel (A4→A3) speicherbar
Veraltete Altwerte (payments/guest_messages = portal), die das gewählte Modell überstimmt, blockierten das Speichern trotz bestätigter Übernahme: problems() prüfte den Entwurf vor der Entfernung, und nicht erlaubte variable Verantwortlichkeiten zählten nicht als Konflikt. Jetzt: conflicts() listet auch nicht mehr erlaubte Verantwortlichkeiten, problems()/profileWith() ignorieren die zu entfernenden Altwerte. Regressionstests A3/A4, Altwerte, Bestätigung, laufende Vorgänge. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ad71c54d2
commit
a3ab1b6657
2 files changed
+101
-2
No files matched your search
@@ -129,7 +129,7 @@ public function test_saving_a_model_that_overrides_a_stored_setting_needs_the_co
|
||||
$configuration = app(ChannelProcessConfiguration::class);
|
||||
|
||||
$conflicts = $configuration->conflicts($channel->refresh(), IntakeKind::Booking, 'a3.portal_booking');
|
||||
$this->assertSame([ProcessSetting::Payments], array_column($conflicts, 'setting'));
|
||||
$this->assertSame([ProcessSetting::Payments, ProcessSetting::GuestMessages], array_column($conflicts, 'setting'), 'fixed and no longer allowed responsibilities are both listed');
|
||||
|
||||
try {
|
||||
app(ConfigureChannelProcess::class)->handle($channel, IntakeKind::Booking, ['model' => 'a3.portal_booking'], by: 'Lars');
|
||||
@@ -144,10 +144,73 @@ public function test_saving_a_model_that_overrides_a_stored_setting_needs_the_co
|
||||
|
||||
$channel->refresh();
|
||||
$this->assertArrayNotHasKey('payments', $channel->process_overrides['booking']);
|
||||
$this->assertSame('portal', $channel->process_overrides['booking']['guest_messages'], 'what the model does not fix stays');
|
||||
$this->assertArrayNotHasKey('guest_messages', $channel->process_overrides['booking'], 'a responsibility the model does not allow is removed with it');
|
||||
$this->assertStringContainsString('Bisher eingestellt', $channel->settings['process_history'][0]['removed_settings'][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Regression: Destination Solutions with the old `payments = portal`, switched to A3 in the configurator with the
|
||||
* confirmation. The page carries the stale value in its draft; saving used to fail with "Inkasso … nicht zulässig".
|
||||
*/
|
||||
public function test_confirmed_switch_from_old_portal_collection_to_a3_saves_through_the_page(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', ['booking' => ['payments' => 'portal', 'guest_messages' => 'portal', 'contract_delivery' => 'manual']]);
|
||||
$this->actingAs(User::factory()->create());
|
||||
|
||||
$page = Livewire::test(ChannelProcess::class, ['record' => $ds->getRouteKey()])->set('intake', 'booking');
|
||||
$this->assertSame('portal', $page->get('drafts')['booking']['settings']['payments'], 'the page carries the stale value');
|
||||
$page->set('capabilityDraft.collects_payment', '0')->call('chooseModel', 'a3.portal_booking');
|
||||
$this->assertSame([], $page->instance()->problems(), 'a stored value the confirmed switch removes is not an error');
|
||||
|
||||
$page->call('save')->assertNotified('Nicht gespeichert');
|
||||
$this->assertSame('portal', $ds->fresh()->process_overrides['booking']['payments'], 'without the confirmation nothing changes');
|
||||
|
||||
$page->set('acknowledge', true)->call('save')->assertNotified('Ablauf gespeichert');
|
||||
|
||||
$ds->refresh();
|
||||
$this->assertSame('a3.portal_booking', $ds->process_overrides['booking']['model']);
|
||||
$this->assertArrayNotHasKey('payments', $ds->process_overrides['booking']);
|
||||
$this->assertArrayNotHasKey('guest_messages', $ds->process_overrides['booking'], 'a responsibility the model does not allow goes with it');
|
||||
$this->assertSame('manual', $ds->process_overrides['booking']['contract_delivery'], 'unrelated stored settings stay');
|
||||
$this->assertSame([], $page->instance()->conflicts(), 'the stale setting does not return as an error or conflict');
|
||||
$this->assertSame([], $page->instance()->problems());
|
||||
$this->assertArrayNotHasKey('payments', $page->get('drafts')['booking']['settings']);
|
||||
}
|
||||
|
||||
/** A3 → A4 → A3 keeps the stored values consistent; stored values the target model accepts are untouched. */
|
||||
public function test_switching_between_a3_and_a4_keeps_settings_consistent(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
$configuration = app(ChannelProcessConfiguration::class);
|
||||
$save = app(ConfigureChannelProcess::class);
|
||||
|
||||
$save->handle($ds, IntakeKind::Booking, ['model' => 'a3.portal_booking', 'capabilities' => ['collects_payment' => '0'], 'settings' => ['guest_messages' => 'landlord']], by: 'Lars');
|
||||
$this->assertSame('landlord', $ds->fresh()->process_overrides['booking']['guest_messages']);
|
||||
|
||||
$save->handle($ds->fresh(), IntakeKind::Booking, ['model' => 'a4.portal_booking', 'capabilities' => ['collects_payment' => '1']], by: 'Lars');
|
||||
$this->assertSame('a4.portal_booking', $ds->fresh()->process_overrides['booking']['model']);
|
||||
$this->assertSame([], $configuration->conflicts($ds->fresh(), IntakeKind::Booking, 'a4.portal_booking'));
|
||||
|
||||
$save->handle($ds->fresh(), IntakeKind::Booking, ['model' => 'a3.portal_booking', 'capabilities' => ['collects_payment' => '0']], by: 'Lars');
|
||||
$this->assertSame('a3.portal_booking', $ds->fresh()->process_overrides['booking']['model']);
|
||||
}
|
||||
|
||||
/** A running case keeps its frozen plan when the channel model changes; other channels and intake kinds stay untouched. */
|
||||
public function test_a_confirmed_switch_does_not_touch_running_cases_or_other_channels(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', ['booking' => ['payments' => 'portal']]);
|
||||
$other = $this->channel('Sonstiges Portal', ['booking' => ['payments' => 'portal'], 'inquiry' => ['hold_hours' => 12]]);
|
||||
$ds->update(['process_overrides' => [...$ds->process_overrides, 'inquiry' => ['hold_hours' => 24]]]);
|
||||
$booking = app(TakeOverExternalBooking::class)->handle($this->property, $ds->fresh(), CarbonImmutable::parse('2026-12-05'), CarbonImmutable::parse('2026-12-09'), ['portal_reference' => 'DS-ALT']);
|
||||
$frozen = $booking->fresh()->profile;
|
||||
|
||||
app(ConfigureChannelProcess::class)->handle($ds->fresh(), IntakeKind::Booking, ['model' => 'a3.portal_booking', 'capabilities' => ['collects_payment' => '0'], 'settings' => ['payments' => 'portal']], by: 'Lars', acknowledgeConflicts: true);
|
||||
|
||||
$this->assertSame($frozen, $booking->fresh()->profile, 'the running case keeps its frozen plan');
|
||||
$this->assertSame('portal', $other->fresh()->process_overrides['booking']['payments'], 'another channel is untouched');
|
||||
$this->assertSame(['hold_hours' => 24], array_intersect_key($ds->fresh()->process_overrides['inquiry'], ['hold_hours' => 1]), 'the other intake kind is untouched');
|
||||
}
|
||||
|
||||
public function test_unknown_capabilities_block_nothing_but_ask_for_confirmation(): void
|
||||
{
|
||||
$generic = $this->channel('Irgendein Portal', []);
|
||||
|
||||
Reference in new issue
Block a user