/** * @test */ public function it_gets_all_messages_before_the_given_date_and_sets_them_as_read() { $imap = $this->getImap(); /** @noinspection PhpUndefinedMethodInspection */ $imap->shouldReceive('sort')->with('BEFORE "11-Jan-2016"', SORTDATE, true, 0)->andReturn([1, 2]); $mailboxManager = new ImapMailboxService($imap); $this->assertEquals([1, 2], $mailboxManager->getMessagesBefore('2016-01-11', SORTDATE, true, false)); }