@@ -73,6 +73,21 @@ private function insertMessage(int $uid, int $mailbox_id): void {
7373 $ insert ->executeStatement ();
7474 }
7575
76+ private function insertMessageWithId (int $ id , int $ mailbox_id ): void {
77+ $ qb = $ this ->db ->getQueryBuilder ();
78+ $ insert = $ qb ->insert ($ this ->mapper ->getTableName ())
79+ ->values ([
80+ 'id ' => $ qb ->createNamedParameter ($ id , IQueryBuilder::PARAM_INT ),
81+ 'uid ' => $ qb ->createNamedParameter ($ id , IQueryBuilder::PARAM_INT ),
82+ 'message_id ' => $ qb ->createNamedParameter ('<abc ' . $ id . $ mailbox_id . '@123.com> ' ),
83+ 'mailbox_id ' => $ qb ->createNamedParameter ($ mailbox_id , IQueryBuilder::PARAM_INT ),
84+ 'subject ' => $ qb ->createNamedParameter ('TEST ' ),
85+ 'sent_at ' => $ qb ->createNamedParameter ($ this ->time ->getTime (), IQueryBuilder::PARAM_INT ),
86+ 'in_reply_to ' => $ qb ->createNamedParameter ('<> ' )
87+ ]);
88+ $ insert ->executeStatement ();
89+ }
90+
7691 public function testResetInReplyTo () : void {
7792 $ account = $ this ->createMock (Account::class);
7893 $ account ->method ('getId ' )->willReturn (13 );
@@ -238,12 +253,12 @@ public function testFindIdsAfter() : void {
238253 $ mailbox = new Mailbox ();
239254 $ mailbox ->setId (4 );
240255 $ this ->timestamp = 1234567890 ;
241- array_map (function ($ i ) {
242- $ this ->insertMessage ($ i , 1 );
256+ array_map (function ($ i ) use ( $ mailbox ) {
257+ $ this ->insertMessageWithId ($ i , $ mailbox -> getId () );
243258 }, range (1 , 5 ));
244259 $ this ->timestamp = 1234567891 + 100 ;
245- array_map (function ($ i ) {
246- $ this ->insertMessage ($ i , 1 );
260+ array_map (function ($ i ) use ( $ mailbox ) {
261+ $ this ->insertMessageWithId ($ i , $ mailbox -> getId () );
247262 }, range (6 , 10 ));
248263
249264 $ mails = $ this ->mapper ->findIdsAfter ($ mailbox , 2 , 0 , 5 );
0 commit comments