/**
  * @test
  */
 public function it_creates_an_ImapMessageCollection_object()
 {
     $imap = m::mock('Humps\\MailManager\\Contracts\\Imap');
     $imap->shouldReceive('getMessageHeaders')->andReturn(ImapMailManagerTestHelper::getMessageHeaders());
     $imap->shouldReceive('fetchStructure')->andReturn(ImapMailManagerTestHelper::fetchStructure());
     $imap->shouldReceive('fetchBody')->andReturn(ImapMailManagerTestHelper::fetchBody());
     $messages = ImapMessageCollectionFactory::create([1, 2], $imap);
     $this->assertInstanceOf('Humps\\MailManager\\Collections\\ImapMessageCollection', $messages);
     $this->assertEquals(2, count($messages));
 }
 public function setUp()
 {
     /**
      * @var Imap $imap
      */
     $imap = m::mock('Humps\\MailManager\\Contracts\\Imap');
     $imap->shouldReceive('getMessageHeaders')->andReturn(ImapMailManagerTestHelper::getMessageHeaders());
     $imap->shouldReceive('fetchStructure')->andReturn(ImapMailManagerTestHelper::fetchStructure());
     $imap->shouldReceive('fetchBody')->andReturn(ImapMailManagerTestHelper::fetchBody());
     /**
      * @var ImapMessage $message
      */
     $this->message = ImapMessageFactory::create(1, $imap);
 }
 /**
  * @param $connection
  * @return ImapHandler
  */
 protected function getImapMock($connection)
 {
     /**
      * @var ImapHandler $imap
      */
     $imap = m::mock('Humps\\MailManager\\Contracts\\Imap');
     $imap->shouldReceive('fetchStructure')->andReturn(ImapMailManagerTestHelper::fetchStructure());
     $imap->shouldReceive('fetchBody')->andReturn(ImapMailManagerTestHelper::fetchBody(2));
     $imap->shouldReceive('getFolderName')->andReturn('inbox');
     $imap->shouldReceive('getConnection')->andReturn($connection);
     return $imap;
 }