File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 33use DirectoryTree \ImapEngine \Connection \ImapConnection ;
44use DirectoryTree \ImapEngine \Connection \ImapQueryBuilder ;
55use DirectoryTree \ImapEngine \Connection \Streams \FakeStream ;
6+ use DirectoryTree \ImapEngine \Enums \ImapFlag ;
67use DirectoryTree \ImapEngine \Folder ;
78use DirectoryTree \ImapEngine \Mailbox ;
89use DirectoryTree \ImapEngine \MessageQuery ;
@@ -181,3 +182,25 @@ function query(?Mailbox $mailbox = null): MessageQuery
181182 // Should only process the first chunk (page 1)
182183 expect ($ processedChunks )->toBe ([1 ]);
183184});
185+
186+ test ('append with single flag converts to array ' , function (mixed $ flag ) {
187+ $ stream = new FakeStream ;
188+ $ stream ->open ();
189+
190+ $ stream ->feed ([
191+ '* OK Welcome to IMAP ' ,
192+ 'TAG1 OK Logged in ' ,
193+ 'TAG2 OK [APPENDUID 1234567890 1] APPEND completed ' ,
194+ ]);
195+
196+ $ mailbox = Mailbox::make ();
197+ $ mailbox ->connect (new ImapConnection ($ stream ));
198+
199+ $ folder = new Folder ($ mailbox , 'INBOX ' );
200+ $ query = new MessageQuery ($ folder , new ImapQueryBuilder );
201+
202+ $ uid = $ query ->append ('Hello world ' , $ flag );
203+
204+ expect ($ uid )->toBe (1 );
205+ $ stream ->assertWritten ('TAG2 APPEND "INBOX" ( \\Seen) "Hello world" ' );
206+ })->with ([ImapFlag::Seen, '\\Seen ' ]);
You can’t perform that action at this time.
0 commit comments