Kanalkonfigurator und Prozess-Tester auf Schablonenbasis
Geschäftsentscheidungen zuerst (Schablonen je Bereich, Voreinstellungen A3–A5), Einzelschritte eingeklappt, Auswirkungsanalyse beim Schablonenwechsel, unbestätigte Portal-Fähigkeiten gekennzeichnet. Tester-Bericht nennt Schablonen, unabhängig laufende Schritte und fehlende Nachweise; alle vier Kombinationen sind als Szenario getestet. Doku: SCHABLONEN.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e95ba4f986
commit
c46f4a032b
12 files changed
+810
-10
No files matched your search
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Process;
|
||||
|
||||
use App\Actions\ConfigureChannelProcess;
|
||||
use App\Actions\TakeOverExternalBooking;
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Filament\Resources\Channels\Pages\ChannelProcess;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use App\Process\ChannelProcessConfiguration;
|
||||
use App\Process\ConfigurationImpact;
|
||||
use App\Process\ProcessCatalogue;
|
||||
use App\Process\ProcessPlan;
|
||||
use App\Process\ProcessProfile;
|
||||
use App\Process\ProcessSettings;
|
||||
use App\Support\Content;
|
||||
use App\Support\Settings;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Mail\MailManager;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Livewire\Livewire;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* The channel configurator on the composition: the business decisions come first, the single steps stay reachable and
|
||||
* configurable, nothing changes silently, running cases keep their plan.
|
||||
*/
|
||||
#[Group('configurator')]
|
||||
class TemplateConfiguratorTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-23 18:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Storage::fake('local');
|
||||
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
|
||||
config(['mail.default' => 'array']);
|
||||
Mail::swap(new MailManager($this->app));
|
||||
Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'test@example.org']);
|
||||
Http::preventStrayRequests();
|
||||
$this->actingAs(User::factory()->create());
|
||||
}
|
||||
|
||||
public function test_the_page_shows_the_business_decisions_first_and_keeps_the_steps_reachable(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
|
||||
Livewire::test(ChannelProcess::class, ['record' => $ds->getRouteKey()])
|
||||
->call('chooseModel', 'external.booking')
|
||||
->assertSee('Geschäftsentscheidungen')
|
||||
->assertSee('Wer zieht das Geld des Gastes ein?')
|
||||
->assertSee('Eigenes Inkasso')
|
||||
->assertSee('Portal-Inkasso')
|
||||
->assertSee('Eigene Vertragsdokumentation')
|
||||
->assertSee('Externe Vertragsunterlagen')
|
||||
->assertSee('Mehrstufige Mahnungen', escape: false)
|
||||
->assertSee('Einzelschritte einstellen')
|
||||
->assertSee('Zahlungen des Gastes');
|
||||
}
|
||||
|
||||
public function test_an_archetype_moves_to_the_base_process_with_the_same_combination_and_saves(): void
|
||||
{
|
||||
$fewo = $this->channel('FeWo-direkt', [], 'mixed');
|
||||
$page = Livewire::test(ChannelProcess::class, ['record' => $fewo->getRouteKey()])->set('intake', 'booking');
|
||||
|
||||
$page->assertSee('Auf Schablonen umstellen')->call('applyPreset', 'a4.portal_booking');
|
||||
$this->assertSame(['external.booking', ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own']], [$page->get('drafts')['booking']['model'], $page->get('drafts')['booking']['templates']]);
|
||||
$this->assertSame([], $page->instance()->problems());
|
||||
|
||||
$page->call('save')->assertNotified('Ablauf gespeichert');
|
||||
$this->assertSame('external.booking', $fewo->fresh()->process_overrides['booking']['model']);
|
||||
$this->assertEquals(['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own'], $fewo->fresh()->process_overrides['booking']['templates']);
|
||||
|
||||
$booking = $this->takeOver($fewo->fresh(), 'FD-1');
|
||||
$this->assertEquals(['collection' => 'collection.portal@1', 'contract_documents' => 'contract_docs.own@1'], ProcessPlan::of($booking)->templates);
|
||||
$this->assertSame('A4', strtoupper($booking->case_type->value));
|
||||
}
|
||||
|
||||
public function test_a_template_the_portal_cannot_support_cannot_be_chosen_and_says_why(): void
|
||||
{
|
||||
$fewo = $this->channel('FeWo-direkt', [], 'mixed');
|
||||
$page = Livewire::test(ChannelProcess::class, ['record' => $fewo->getRouteKey()])->set('intake', 'booking')->call('applyPreset', 'a4.portal_booking');
|
||||
|
||||
$page->call('chooseTemplate', 'collection', 'collection.own');
|
||||
$this->assertSame('collection.portal', $page->get('drafts')['booking']['templates']['collection'], 'refused: FeWo-direkt collects the money');
|
||||
$page->assertSee('Passt gerade nicht')->assertSee('Zieht das Portal das Geld des Gastes ein?');
|
||||
|
||||
// The landlord corrects the capability first: now the template fits.
|
||||
$page->set('capabilityDraft.collects_payment', '0')->call('chooseTemplate', 'collection', 'collection.own');
|
||||
$this->assertSame('collection.own', $page->get('drafts')['booking']['templates']['collection']);
|
||||
}
|
||||
|
||||
public function test_unconfirmed_capabilities_are_flagged_and_never_taken_as_proven(): void
|
||||
{
|
||||
$generic = $this->channel('Irgendein Portal', [], 'portal_booking');
|
||||
$options = app(ChannelProcessConfiguration::class)->templateOptions($generic, app(ProcessCatalogue::class)->model('external.booking'));
|
||||
|
||||
$this->assertTrue($options['collection']['collection.own']['admissible'], 'unknown blocks nothing');
|
||||
$this->assertSame(['collects_payment'], $options['collection']['collection.own']['unconfirmed']);
|
||||
$this->assertNotSame([], $options['contract_documents']['contract_docs.external']['hints']);
|
||||
|
||||
$fewo = $this->channel('FeWo-direkt Profil', [], 'mixed');
|
||||
$suggested = app(ChannelProcessConfiguration::class)->templateOptions($fewo, app(ProcessCatalogue::class)->model('external.booking'));
|
||||
$this->assertContains('collects_payment', $suggested['collection']['collection.portal']['unconfirmed'], 'a suggestion of the channel profile is not a confirmation');
|
||||
$this->assertStringContainsString('nicht als bestätigt', implode(' ', $suggested['collection']['collection.portal']['hints']));
|
||||
}
|
||||
|
||||
/** The A4 → A3 regression of the archetypes, now as a switch of the collection template */
|
||||
public function test_switching_the_collection_template_shows_every_consequence_and_needs_the_confirmation(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', ['booking' => ['payments' => 'portal', 'guest_messages' => 'portal', 'contract_delivery' => 'manual', 'steps' => ['review.request' => ['on' => false]]]]);
|
||||
$ds->update(['settings' => [...(array) $ds->settings, 'capabilities' => ['messages_guest' => ['value' => false, 'at' => now()->toIso8601String(), 'by' => 'Lars']]]]);
|
||||
$page = Livewire::test(ChannelProcess::class, ['record' => $ds->getRouteKey()])->set('intake', 'booking');
|
||||
|
||||
$page->set('capabilityDraft.collects_payment', '0')->call('chooseModel', 'external.booking')->call('chooseTemplate', 'collection', 'collection.own');
|
||||
$conflicts = collect($page->instance()->conflicts())->map(fn (array $conflict): string => $conflict['setting']->value)->all();
|
||||
$this->assertEqualsCanonicalizing(['payments', 'guest_messages'], $conflicts, 'the stale collection and the stale portal communication are conflicts, not silent changes');
|
||||
$page->assertSee('Bisherige Einstellungen widersprechen');
|
||||
|
||||
$page->call('save')->assertNotified('Nicht gespeichert');
|
||||
$this->assertSame('portal', $ds->fresh()->process_overrides['booking']['payments'], 'nothing changed without the confirmation');
|
||||
|
||||
$page->set('acknowledge', true)->call('save')->assertNotified('Ablauf gespeichert');
|
||||
$saved = $ds->fresh()->process_overrides['booking'];
|
||||
$this->assertSame('external.booking', $saved['model']);
|
||||
$this->assertArrayNotHasKey('payments', $saved);
|
||||
$this->assertArrayNotHasKey('guest_messages', $saved);
|
||||
$this->assertSame('manual', $saved['contract_delivery'], 'parameters of the kept modules survive');
|
||||
$this->assertSame(['review.request' => ['on' => false]], $saved['steps'], 'so does a switched-off optional step');
|
||||
$this->assertStringContainsString('Bisher eingestellt', $ds->fresh()->settings['process_history'][0]['removed_settings'][0]);
|
||||
$this->assertEquals(['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own'], $saved['templates']);
|
||||
}
|
||||
|
||||
public function test_the_impact_of_a_template_change_names_modules_responsibility_and_open_ends(): void
|
||||
{
|
||||
$fewo = $this->channel('FeWo-direkt', ['booking' => ['steps' => []]], 'mixed');
|
||||
app(ConfigureChannelProcess::class)->handle($fewo, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own']]);
|
||||
|
||||
$impact = app(ConfigurationImpact::class)->ofTemplates($fewo->fresh(), IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.external']]);
|
||||
|
||||
$impact = collect($impact)->keyBy('area');
|
||||
$this->assertEqualsCanonicalizing(['Finanzabwicklung (Inkasso)', 'Vertragsdokumentation'], $impact->keys()->all());
|
||||
$finance = $impact['Finanzabwicklung (Inkasso)'];
|
||||
$documents = $impact['Vertragsdokumentation'];
|
||||
$this->assertSame(['Portal-Inkasso', 'Eigenes Inkasso'], [$finance['from'], $finance['to']]);
|
||||
$this->assertSame(['Auszahlung des Portals'], $finance['removed']);
|
||||
$this->assertSame(['Zahlungen des Gastes'], $finance['kept']);
|
||||
$this->assertSame(['from' => 'Das Portal', 'to' => 'Wir'], $finance['responsibility']);
|
||||
$this->assertContains('Mehrstufige Mahnungen (rechtliche Ausgestaltung offen)', $finance['extensions']);
|
||||
$this->assertSame(['from' => 'Wir', 'to' => 'Das Portal'], $documents['responsibility']);
|
||||
$this->assertSame([], app(ConfigurationImpact::class)->ofTemplates($fewo->fresh(), IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.own']]), 'no change, no impact');
|
||||
}
|
||||
|
||||
public function test_the_modules_of_a_template_stay_individually_configurable_and_the_inheritance_holds(): void
|
||||
{
|
||||
Settings::tenant()->update(['process_defaults' => ['contract_delivery' => 'manual']]);
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
app(ConfigureChannelProcess::class)->handle($ds, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own']]);
|
||||
|
||||
$page = Livewire::test(ChannelProcess::class, ['record' => $ds->fresh()->getRouteKey()])->set('intake', 'booking');
|
||||
$documents = collect($page->instance()->steps())->firstWhere('module', 'documents.send');
|
||||
$this->assertSame('Eigene Vertragsdokumentation', $documents['template']);
|
||||
$this->assertContains('contract_delivery', array_column($documents['parameters'], 'key'), 'the module of the template has its own parameters');
|
||||
$this->assertNotNull($documents['mode_setting'], 'and its own mode');
|
||||
$this->assertSame('manual', app(ProcessSettings::class)->resolve($this->property, $ds->fresh(), IntakeKind::Booking)->value(ProcessSetting::ContractDelivery));
|
||||
$this->assertSame(ProcessProfile::TENANT, app(ProcessSettings::class)->resolve($this->property, $ds->fresh(), IntakeKind::Booking)->source(ProcessSetting::ContractDelivery));
|
||||
|
||||
$page->set('drafts.booking.settings.contract_delivery', 'automatic')->set('drafts.booking.settings.processing', 'approval')->call('save')->assertNotified('Ablauf gespeichert');
|
||||
$profile = app(ProcessSettings::class)->resolve($this->property, $ds->fresh(), IntakeKind::Booking);
|
||||
$this->assertSame(['automatic', ProcessProfile::CHANNEL], [$profile->value(ProcessSetting::ContractDelivery), $profile->source(ProcessSetting::ContractDelivery)]);
|
||||
$this->assertSame(ProcessProfile::TEMPLATE, $profile->source(ProcessSetting::Payments));
|
||||
}
|
||||
|
||||
public function test_a_template_does_not_override_a_parameter_set_by_hand_and_a_contradicting_responsibility_is_refused(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
$configuration = app(ChannelProcessConfiguration::class);
|
||||
|
||||
$problems = $configuration->problems($ds, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own'], 'settings' => ['payments' => 'portal']]);
|
||||
$this->assertNotSame([], $problems, 'a responsibility set by hand may not contradict the template');
|
||||
$this->assertStringContainsString('widerspricht der Schablone', implode(' ', $problems));
|
||||
$this->assertSame([], $configuration->problems($ds, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own'], 'settings' => ['payments' => 'landlord', 'contract_delivery' => 'manual']]));
|
||||
|
||||
$this->expectException(ValidationException::class);
|
||||
app(ConfigureChannelProcess::class)->handle($ds, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own'], 'settings' => ['payments' => 'portal']]);
|
||||
}
|
||||
|
||||
public function test_changing_the_templates_leaves_running_cases_and_their_plans_untouched(): void
|
||||
{
|
||||
$ds = $this->channel('Destination Solution', []);
|
||||
app(ConfigureChannelProcess::class)->handle($ds, IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.own', 'contract_documents' => 'contract_docs.own']]);
|
||||
$running = $this->takeOver($ds->fresh(), 'DS-ALT');
|
||||
$frozen = $running->fresh()->profile;
|
||||
|
||||
app(ConfigureChannelProcess::class)->handle($ds->fresh(), IntakeKind::Booking, ['model' => 'external.booking', 'templates' => ['collection' => 'collection.portal', 'contract_documents' => 'contract_docs.external'], 'capabilities' => ['collects_payment' => '1', 'provides_contract_documents' => '1']]);
|
||||
$new = $this->takeOver($ds->fresh(), 'DS-NEU', '2027-09-10');
|
||||
|
||||
$this->assertSame($frozen, $running->fresh()->profile, 'the running case keeps profile and plan');
|
||||
$this->assertSame('collection.own@1', ProcessPlan::of($running->fresh())->templates['collection']);
|
||||
$this->assertSame('collection.portal@1', ProcessPlan::of($new)->templates['collection']);
|
||||
$this->assertSame(['landlord', 'portal'], [$running->fresh()->process()->payments()->value, $new->process()->payments()->value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $overrides
|
||||
*/
|
||||
private function channel(string $name, array $overrides, string $model = 'portal_booking'): Channel
|
||||
{
|
||||
return Channel::factory()->for($this->property)->create(['name' => $name, 'booking_model' => $model, 'process_overrides' => $overrides, 'import_enabled' => false, 'settings' => ['import_url' => 'https://portal.example/'.md5($name).'.ics']]);
|
||||
}
|
||||
|
||||
private function takeOver(Channel $channel, string $reference, string $arrival = '2027-07-10'): Booking
|
||||
{
|
||||
$arrival = CarbonImmutable::parse($arrival);
|
||||
|
||||
return app(TakeOverExternalBooking::class)->handle($this->property, $channel, $arrival, $arrival->addDays(7), ['portal_reference' => $reference]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Process;
|
||||
|
||||
use App\Enums\IntakeKind;
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingTask;
|
||||
use App\Models\Channel;
|
||||
use App\Models\Property;
|
||||
use App\Models\User;
|
||||
use App\Process\Tester\ProcessSandbox;
|
||||
use App\Support\Content;
|
||||
use App\Support\Settings;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Database\Seeders\PropertySeeder;
|
||||
use Database\Seeders\SiteSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Acceptance of the template composition: the four combinations of collection and contract documentation are played
|
||||
* through the isolated process tester with a synthetic externally binding booking. The report must show the templates
|
||||
* used, which steps run independently of waiting ones and which evidence is missing – and the combinations must differ in
|
||||
* exactly the way their templates promise.
|
||||
*/
|
||||
#[Group('sandbox')]
|
||||
class TemplateProcessTesterTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private Property $property;
|
||||
|
||||
private User $user;
|
||||
|
||||
private Channel $portal;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->travelTo(CarbonImmutable::parse('2026-10-23 10:00'));
|
||||
$this->seed([PropertySeeder::class, SiteSeeder::class]);
|
||||
$this->property = Property::sole();
|
||||
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
|
||||
Settings::tenant()->update(['bank_iban' => 'DE02120300000000202051', 'test_recipient' => 'vermieter@example.org', 'process_defaults' => ['processing' => 'automatic']]);
|
||||
$this->user = User::factory()->create();
|
||||
ProcessTesterTest::template();
|
||||
$this->portal = Channel::factory()->for($this->property)->create(['name' => 'Destination Solution', 'booking_model' => 'portal_booking', 'status' => 'setup', 'is_active' => false, 'import_enabled' => false, 'settings' => ['import_url' => 'https://ds.example/a.ics', 'email_senders' => 'ds.example', 'portal_profile' => 'generic']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: string, 1: string}>
|
||||
*/
|
||||
public static function combinations(): array
|
||||
{
|
||||
return [
|
||||
'eigenes Inkasso + eigene Vertragsdokumentation' => ['collection.own', 'contract_docs.own'],
|
||||
'Portal-Inkasso + eigene Vertragsdokumentation' => ['collection.portal', 'contract_docs.own'],
|
||||
'Portal-Inkasso + externe Vertragsunterlagen' => ['collection.portal', 'contract_docs.external'],
|
||||
'eigenes Inkasso + externe Vertragsunterlagen' => ['collection.own', 'contract_docs.external'],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('combinations')]
|
||||
public function test_every_combination_runs_in_the_tester_and_differs_as_its_templates_promise(string $collection, string $documents): void
|
||||
{
|
||||
$report = $this->play($collection, $documents);
|
||||
|
||||
$this->assertNull($report['aborted'] ?? null, json_encode($report));
|
||||
$this->assertSame([], $report['violations']);
|
||||
$this->assertSame(['external.booking', 1], [$report['plan']['model'], $report['plan']['version']]);
|
||||
$this->assertEqualsCanonicalizing([$collection.'@1', $documents.'@1'], array_column($report['plan']['templates'], 'reference'), 'the report names the templates used');
|
||||
foreach ($report['plan']['templates'] as $template) {
|
||||
$this->assertNotEmpty($template['modules']);
|
||||
$this->assertFalse($template['capabilities'][0]['confirmed'], 'a capability nobody confirmed is not shown as proven');
|
||||
}
|
||||
|
||||
[$known, , $confirmed] = $report['timeline'];
|
||||
$labels = fn (array $event): array => array_column($event['activities'], 'label');
|
||||
$states = fn (array $event): array => array_column($event['activities'], 'state_key', 'label');
|
||||
|
||||
// Finance: exactly one of the two collections shows up.
|
||||
if ($collection === 'collection.own') {
|
||||
$this->assertContains('Anzahlung erhalten', $labels($known));
|
||||
$this->assertNotContains('Auszahlung von Destination Solution auf unser Konto', $labels($known));
|
||||
$this->assertEmpty(array_filter($labels($known), fn (string $label): bool => str_starts_with($label, 'Zahlung des Gastes an')), 'no portal collection');
|
||||
$this->assertContains('Anzahlung erhalten', $known['waiting'], 'we wait for the guest payments: evidence is missing');
|
||||
} else {
|
||||
$this->assertNotContains('Anzahlung erhalten', $labels($known), 'no own payment request towards the guest');
|
||||
$this->assertSame('external', $states($known)['Zahlung des Gastes an Destination Solution']);
|
||||
$this->assertContains('Auszahlung von Destination Solution auf unser Konto', $known['waiting'], 'the payout evidence is missing');
|
||||
}
|
||||
|
||||
// Contract documentation: ours has to be checked and sent, the portal's is external. Only ours ever goes out as a contract.
|
||||
if ($documents === 'contract_docs.own') {
|
||||
$this->assertSame('waiting', $states($known)['Buchungsunterlagen prüfen und senden'], 'our documents wait for the portal confirmation');
|
||||
$this->assertSame('open', $states($confirmed)['Buchungsunterlagen prüfen und senden'], 'then the landlord sends them (approval, not automatic)');
|
||||
} else {
|
||||
$this->assertSame('external', $states($known)['Buchungsunterlagen an den Gast']);
|
||||
$this->assertNotContains('Buchungsunterlagen prüfen und senden', $labels($confirmed));
|
||||
$this->assertEmpty(array_filter(array_column($confirmed['mails'], 'subject'), fn (string $subject): bool => str_contains($subject, 'Buchungsbestätigung') || str_contains($subject, 'Mietvertrag')), 'no contract from us');
|
||||
}
|
||||
|
||||
// Independent steps keep running while the confirmation, the documents and the payments wait.
|
||||
$this->assertContains('Kontaktdaten des Gastes', $known['independent']);
|
||||
$this->assertContains('Anreisedaten', $known['independent']);
|
||||
$this->assertContains('Bestätigung des Portals abwarten', $confirmed['independent'], 'the confirmation ends while the payments still wait');
|
||||
$this->assertContains('Buchungsinformation an den Gast (automatisch)', $confirmed['independent']);
|
||||
|
||||
$this->assertSame(0, Booking::query()->count(), 'nothing reached the real data');
|
||||
$this->assertSame(0, BookingTask::query()->count());
|
||||
}
|
||||
|
||||
public function test_the_tester_runs_the_fourth_combination_and_marks_it_as_such(): void
|
||||
{
|
||||
$report = $this->play('collection.own', 'contract_docs.external');
|
||||
|
||||
$this->assertSame('A3', $report['plan']['case_type'], 'classified by who collects – no archetype of its own');
|
||||
$values = collect($report['plan']['configuration'])->keyBy('question');
|
||||
$this->assertSame(['Wir', 'festgelegt durch die gewählte Funktionsschablone'], [$values['Wer kümmert sich um die Zahlungen des Gastes?']['value'] ?? null, $values['Wer kümmert sich um die Zahlungen des Gastes?']['source'] ?? null]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function play(string $collection, string $documents): array
|
||||
{
|
||||
$draft = ['model' => 'external.booking', 'templates' => ['collection' => $collection, 'contract_documents' => $documents], 'settings' => ['await_portal_confirmation' => '1', 'booking_notice' => 'automatic']];
|
||||
|
||||
return app(ProcessSandbox::class)->run($this->portal, IntakeKind::Booking, $draft, 'portal_confirmation_wait', ['arrival' => '2026-11-14', 'nights' => 4, 'guests' => 2, 'confirmation' => 'late'], 6, $this->user)->report;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user