Skip to content

Commit 9c920bb

Browse files
committed
Add tests
1 parent 4c6f3f7 commit 9c920bb

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/Unit/Connection/ImapQueryBuilderTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,43 @@ function (ImapQueryBuilder $q) {
244244

245245
expect($builder->toImap())->toBe('UID 2,3,5');
246246
});
247+
248+
test('compiles UID range to infinity with from and to', function () {
249+
$builder = new ImapQueryBuilder;
250+
251+
$builder->uid(2, INF);
252+
253+
expect($builder->toImap())->toBe('UID 2:*');
254+
});
255+
256+
test('compiles UID range with upper bound with array', function () {
257+
$builder = new ImapQueryBuilder;
258+
259+
$builder->uid([2, 5]);
260+
261+
expect($builder->toImap())->toBe('UID 2,5');
262+
});
263+
264+
test('compiles UID range with upper bound with from and to', function () {
265+
$builder = new ImapQueryBuilder;
266+
267+
$builder->uid(2, 5);
268+
269+
expect($builder->toImap())->toBe('UID 2:5');
270+
});
271+
272+
test('compiles UID range with single value', function () {
273+
$builder = new ImapQueryBuilder;
274+
275+
$builder->uid(2);
276+
277+
expect($builder->toImap())->toBe('UID 2');
278+
});
279+
280+
test('compiles UID range with single value array', function () {
281+
$builder = new ImapQueryBuilder;
282+
283+
$builder->uid([2]);
284+
285+
expect($builder->toImap())->toBe('UID 2');
286+
});

tests/Unit/Support/StrTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
test('set', function () {
77
expect(Str::set(5, 10))->toBe('5:10');
8+
expect(Str::set('5', '10'))->toBe('5:10');
89
expect(Str::set(5, INF))->toBe('5:*');
910
expect(Str::set([5, 10]))->toBe('5,10');
11+
expect(Str::set(['5', '10']))->toBe('5,10');
1012
expect(Str::set([5]))->toBe('5');
1113
expect(Str::set(5))->toBe('5');
1214
});

0 commit comments

Comments
 (0)