M2: Status & Wochentage – Schritt 1 (Logik): CheckOff/Uncheck UseCases + Status-Event + Tests
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user