Skip to content
Prev Previous commit
Updated Test for deleteOldSessions to expect only sessions to be dele…
…ted, not their steps

Signed-off-by: Benjamin Frueh <[email protected]>
  • Loading branch information
benjaminfrueh authored and backportbot[bot] committed Sep 24, 2025
commit 715919d096b384f9e1e493b81aecc5ba6ea870db
22 changes: 1 addition & 21 deletions tests/unit/Db/SessionMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,8 @@ public function testDeleteOldSessions() {
'color' => 'ff0000',
]));

// Create steps for old and recent session
$this->stepMapper->insert(Step::fromParams([
'sessionId' => $oldSession->getId(),
'documentId' => 1,
'data' => 'OLD_STEP',
'version' => 1,
]));
$this->stepMapper->insert(Step::fromParams([
'sessionId' => $recentSession->getId(),
'documentId' => 1,
'data' => 'RECENT_STEP',
'version' => 2,
]));

// Verify 2 sessions and 2 steps
// Verify 2 sessions
self::assertCount(2, $this->sessionMapper->findAll(1));
self::assertCount(2, $this->stepMapper->find(1, 0));

// Delete sessions older than 90 days
$threeMonths = 90 * 24 * 60 * 60;
Expand All @@ -149,10 +134,5 @@ public function testDeleteOldSessions() {
$remainingSessions = $this->sessionMapper->findAll(1);
self::assertCount(1, $remainingSessions);
self::assertEquals($recentSession->getId(), $remainingSessions[0]->getId());

// Should have 1 step from recent session remaining
$remainingSteps = $this->stepMapper->find(1, 0);
self::assertCount(1, $remainingSteps);
self::assertEquals($recentSession->getId(), $remainingSteps[0]->getSessionId());
}
}
Loading