fix: volume gap filling for chapter transitions between different volumes
All checks were successful
Deploy / deploy (push) Successful in 3m3s

`fillVolumeGaps` incorrectly left chapters null when surrounded by two
different non-null volumes (e.g. Vol10 → null → Vol11). Simplify the
condition to always prefer the previous volume, covering all cases.

Also fix `InMemoryMangaRepository::findExistingChaptersByNumbers` to
return an array keyed by chapter number, matching the Doctrine contract.

Add 5 unit tests for MangadxChapterSynchronizationService covering
volume transitions, start-of-series gaps, explicit volumes, FR/EN
priority, and deduplication of existing chapters.
This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2026-03-13 18:43:51 +01:00
parent 465a05c13b
commit d4e456961a
3 changed files with 214 additions and 8 deletions

View File

@@ -267,10 +267,14 @@ class InMemoryMangaRepository implements MangaRepositoryInterface
return [];
}
return array_filter(
$this->chapters[$mangaId],
fn (Chapter $chapter) => in_array($chapter->getNumber(), $chapterNumbers)
);
$result = [];
foreach ($this->chapters[$mangaId] as $chapter) {
if (in_array($chapter->getNumber(), $chapterNumbers)) {
$result[$chapter->getNumber()] = $chapter;
}
}
return $result;
}
public function findByMonitoringCriteria(MonitoringCriteria $criteria): array