Skip to content

Commit ebc794b

Browse files
committed
Move tests into proper folder
1 parent 4040f10 commit ebc794b

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

tests/Unit/ImapConnectionTest.php renamed to tests/Unit/Connection/ImapConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
$connection = new ImapConnection($stream);
477477
$connection->connect('imap.example.com');
478478

479-
$responses = $connection->text(1);
479+
$responses = $connection->bodyText(1);
480480

481481
$stream->assertWritten('TAG1 UID FETCH 1 (BODY.PEEK[TEXT])');
482482

@@ -497,7 +497,7 @@
497497
$connection = new ImapConnection($stream);
498498
$connection->connect('imap.example.com');
499499

500-
$responses = $connection->header(1);
500+
$responses = $connection->bodyHeader(1);
501501

502502
$stream->assertWritten('TAG1 UID FETCH 1 (BODY.PEEK[HEADER])');
503503

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@
209209
expect((string) $response2)->toBe('TAG1 OK GETQUOTA completed');
210210
});
211211

212+
test('parses bodystructure', function () {
213+
$stream = new FakeStream;
214+
$stream->open();
215+
216+
$stream->feed([
217+
'* 1 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "utf-8") NIL NIL "quoted-printable" 11 1 NIL NIL NIL) ("text" "html" ("charset" "utf-8") NIL NIL "quoted-printable" 18 1 NIL NIL NIL) "alternative" ("boundary" "Aq14h3UL") NIL NIL) UID 1)',
218+
]);
219+
220+
$tokenizer = new ImapTokenizer($stream);
221+
$parser = new ImapParser($tokenizer);
222+
223+
$response = $parser->next();
224+
225+
expect($response)->toBeInstanceOf(UntaggedResponse::class);
226+
expect($response->tokens())->toHaveCount(4);
227+
expect((string) $response)->toBe('* 1 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "utf-8") NIL NIL "quoted-printable" 11 1 NIL NIL NIL) ("text" "html" ("charset" "utf-8") NIL NIL "quoted-printable" 18 1 NIL NIL NIL) "alternative" ("boundary" "Aq14h3UL") NIL NIL) UID 1)');
228+
});
229+
212230
test('parses response tokens', function (array|string $feed, string $type, string $value) {
213231
$stream = new FakeStream;
214232
$stream->open();
File renamed without changes.

0 commit comments

Comments
 (0)