M2: Status & Wochentage – Schritt 1 (Logik): CheckOff/Uncheck UseCases + Status-Event + Tests

This commit is contained in:
2026-09-19 10:54:52 +02:00
parent 160b89f5a1
commit 3519ff08f2
6 changed files with 387 additions and 0 deletions
@@ -92,4 +92,34 @@ final class MahlzeitProcessorTest extends DatabaseTestCase
$this->processor()->delete($m);
}
public function testSavePersistiertAbhakenAlsGegessen(): void
{
$jetzt = $this->jetzt();
$created = $this->processor()->create(Mahlzeit::anlegen('Bolognese', '', [Wochentag::Mo], 1, $jetzt));
$gegessen = $created->markAsGegessen($jetzt);
$this->processor()->save($gegessen);
$neu = (new MahlzeitProvider($this->em, new MahlzeitMapper()))->find($created->id);
self::assertNotNull($neu);
self::assertSame(MahlzeitStatus::Gegessen, $neu->status);
self::assertSame($jetzt, $neu->gegessenAm);
self::assertTrue($neu->istGegessen());
}
public function testSavePersistiertAufhebenAlsGeplant(): void
{
$jetzt = $this->jetzt();
$created = $this->processor()->create(Mahlzeit::anlegen('Bolognese', '', [Wochentag::Mo], 1, $jetzt)->markAsGegessen($jetzt));
$geplant = $created->markAsGeplant($jetzt);
$this->processor()->save($geplant);
$neu = (new MahlzeitProvider($this->em, new MahlzeitMapper()))->find($created->id);
self::assertNotNull($neu);
self::assertSame(MahlzeitStatus::Geplant, $neu->status);
self::assertNull($neu->gegessenAm);
self::assertTrue($neu->istGeplant());
}
}