mirror of
https://github.com/retailcrm/Fetch.git
synced 2024-11-25 04:26:02 +03:00
Add: listMailbox function
This commit is contained in:
parent
766db0ad3a
commit
8d29ddeb73
@ -445,4 +445,16 @@ class Server
|
||||
{
|
||||
return imap_createmailbox($this->getImapStream(), $this->getServerSpecification() . $mailbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* List available mailboxes
|
||||
*
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listMailbox($pattern = '*')
|
||||
{
|
||||
return imap_list($this->getImapStream(), $this->getServerSpecification(), $pattern);
|
||||
}
|
||||
}
|
||||
|
@ -205,6 +205,16 @@ class ServerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertFalse($server->getMessageByUid(12), 'Message successfully expunged');
|
||||
}
|
||||
|
||||
public function testListMailbox()
|
||||
{
|
||||
$server = Static::getServer();
|
||||
$spec = sprintf('{%s:143/novalidate-cert}', TESTING_SERVER_HOST);
|
||||
|
||||
$list = $server->listMailbox('*');
|
||||
$this->assertContains($spec.'Sent', $list);
|
||||
$this->assertNotContains($spec.'Cheese', $list);
|
||||
}
|
||||
|
||||
public static function getServer()
|
||||
{
|
||||
$server = new Server(TESTING_SERVER_HOST, 143);
|
||||
|
Loading…
Reference in New Issue
Block a user