/**
  * @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));
 }
 /**
  * @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;
 }
 /**
  * @test
  */
 public function it_excludes_the_body_from_the_message()
 {
     /**
      * @var Imap $imap
      */
     $imap = m::mock('Humps\\MailManager\\Contracts\\Imap');
     $imap->shouldReceive('getMessageHeaders')->andReturn(ImapMailManagerTestHelper::getMessageHeaders());
     $imap->shouldReceive('fetchStructure')->andReturn(ImapMailManagerTestHelper::fetchStructure());
     $message = ImapMessageFactory::create(1, $imap, true);
     $imap->shouldNotHaveReceived('fetchBody');
     $this->assertNull($message->getTextBody());
     $this->assertNull($message->getHtmlBody());
 }