Schreibe beim Menüspeichern nur geänderte Einträge
CI Feature / test (push) Successful in 1m5s
Deploy Test / test (push) Successful in 59s
Deploy Test / deploy (push) Successful in 24s

Unveränderte Einträge erhalten höchstens eine neue Reihenfolge; ein bestehender
Gleichstand in Datenbankfolge bleibt unberührt, Texte werden nur bei Änderung
bereinigt. „Website ansehen“ nennt den gespeicherten Stand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-11-20 12:16:27 +01:00
1 parent 07592f57bd
commit 30dd0f9eb8
3 files changed
+47 -10

No files matched your search

+16
View File
@@ -172,6 +172,22 @@ public function test_reordering_the_main_menu_changes_only_that_menu(): void
$this->assertSame($footerBefore, NavigationItem::query()->where('placement', 'footer')->orderBy('id')->get(['id', 'sort_order', 'updated_at'])->toArray(), 'Der Fußbereich bleibt unberührt (WEB-02).');
}
public function test_saving_writes_only_changed_entries_and_keeps_existing_ties(): void
{
$first = NavigationItem::query()->create(['label' => 'Gleichstand A', 'url' => '/a', 'placement' => 'footer_contact', 'sort_order' => 50]);
$second = NavigationItem::query()->create(['label' => 'Gleichstand B', 'url' => '/b', 'placement' => 'footer_contact', 'sort_order' => 50]);
$spaced = $this->item('Anmelden');
$spaced->forceFill(['label' => ' Anmelden ', 'url' => '/anmelden '])->save();
$untouched = NavigationItem::query()->whereKey([$first->id, $second->id, $spaced->id])->orderBy('id')->get(['id', 'label', 'url', 'sort_order', 'updated_at'])->toArray();
$about = 'e'.$this->item('Über das Projekt')->id;
Carbon::setTestNow(now()->addMinute());
$this->menus()->set("eintraege.$about.label", 'Über uns')->call('speichern')->assertHasNoErrors();
$this->assertSame('Über uns', $this->item('Über uns')->label);
$this->assertSame($untouched, NavigationItem::query()->whereKey([$first->id, $second->id, $spaced->id])->orderBy('id')->get(['id', 'label', 'url', 'sort_order', 'updated_at'])->toArray(), 'Unveränderte Einträge werden nicht geschrieben.');
}
public function test_moves_without_a_valid_neighbour_do_nothing_and_never_change_the_level(): void
{
$component = $this->menus();