Skip to content

Commit 3df20af

Browse files
committed
Add tests
1 parent 936a5b4 commit 3df20af

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

tests/Unit/Connection/ImapQueryBuilderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ function (ImapQueryBuilder $q) {
245245
expect($builder->toImap())->toBe('UID 2,3,5');
246246
});
247247

248-
test('compiles UID range to infinity with from and to', function () {
248+
test('compiles UID range to infinity with from and to as a numeric upper bound', function () {
249249
$builder = new ImapQueryBuilder;
250250

251251
$builder->uid(2, INF);
252252

253-
expect($builder->toImap())->toBe('UID 2:*');
253+
expect($builder->toImap())->toBe('UID 2:4294967295');
254254
});
255255

256256
test('compiles UID range with upper bound with array', function () {

tests/Unit/MessageQueryTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,26 @@ function query(?Mailbox $mailbox = null): MessageQuery
331331
$stream->assertWritten('TAG3 UID STORE 5,6,7,8 +FLAGS.SILENT (\Flagged)');
332332
});
333333

334+
test('uid range to infinity searches with numeric upper bound', function () {
335+
$stream = new FakeStream;
336+
$stream->open();
337+
338+
$stream->feed([
339+
'* OK Welcome to IMAP',
340+
'TAG1 OK Logged in',
341+
'* SEARCH',
342+
'TAG2 OK SEARCH completed',
343+
]);
344+
345+
$mailbox = Mailbox::make();
346+
$mailbox->connect(new ImapConnection($stream));
347+
348+
$messages = query($mailbox)->uid(42, INF)->get();
349+
350+
expect($messages)->toBeEmpty();
351+
$stream->assertWritten('TAG2 UID SEARCH UID 42:4294967295');
352+
});
353+
334354
test('unmarkFlagged unflags all matching messages', function () {
335355
$stream = new FakeStream;
336356
$stream->open();

0 commit comments

Comments
 (0)