feat: serve message lists from the cache

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-10-07 22:15:34 -04:00
parent 852ead324f
commit b1e92e5b07
9 changed files with 800 additions and 5 deletions
+21
View File
@@ -6,6 +6,7 @@ namespace KTXT\ProviderImap\Tests\Support;
use Generator;
use KTXF\Resource\Filter\IFilter;
use KTXF\Resource\Range\IRange;
use KTXF\Resource\Sort\ISort;
use KTXM\ProviderImap\Client\Mailbox;
use KTXM\ProviderImap\Client\Protocol\Command\Argument\FetchOptions;
@@ -75,6 +76,26 @@ final class FakeLiveMailService extends LiveMailService
}
}
/**
* Every message of the mailbox in UID order; filter / sort / range are not evaluated.
*/
public function messageList(string $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null): Generator
{
$this->calls[] = ['messageList', [$collection]];
$uids = array_keys($this->flags);
sort($uids);
yield from $this->messageFetch($collection, null, ...$uids);
}
/** @var int[] UIDs entityFind() returns */
public array $found = [];
public function entityFind(string $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null): array
{
$this->calls[] = ['entityFind', [$collection, $filter]];
return $this->found;
}
public function entityPatch(string $collection, array $flagsToAdd = [], array $flagsToRemove = [], int ...$uids): void
{
$this->calls[] = ['entityPatch', [$collection, $flagsToAdd, $flagsToRemove, $uids]];