/** * @test */ public function it_opens_a_new_folder_without_an_alias() { $imap = $this->getImap(); $this->connection->shouldReceive('refresh')->andReturn(true); /** @noinspection PhpMethodParametersCountMismatchInspection */ $this->mailbox->shouldReceive('setFolder')->with('foo'); /** @noinspection PhpUndefinedMethodInspection */ $imap->shouldReceive('getMailbox')->andReturn($this->mailbox); /** @noinspection PhpUndefinedMethodInspection */ $imap->shouldReceive('refresh')->andReturn(true); $mailboxManager = new ImapMailboxService($imap); $opened = $mailboxManager->openFolder('foo'); /** @noinspection PhpUndefinedMethodInspection */ $this->connection->shouldHaveReceived('refresh')->once(); $this->assertTrue($opened); }