Merge pull request #135 from tedious/delete_mailbox

Added delete mailbox method
This commit is contained in:
Robert Hafner 2015-06-06 23:09:52 -07:00
commit db525aefff
2 changed files with 20 additions and 0 deletions

View File

@ -485,4 +485,16 @@ class Server
{
return imap_list($this->getImapStream(), $this->getServerSpecification(), $pattern);
}
/**
* Deletes the given mailbox.
*
* @param $mailbox
*
* @return bool
*/
public function deleteMailBox($mailbox)
{
return imap_deletemailbox($this->getImapStream(), $this->getServerSpecification() . $mailbox);
}
}

View File

@ -183,6 +183,14 @@ class ServerTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($server->hasMailBox('Cheese'), 'Mailbox "Cheese" was created');
}
public function testDeleteMailbox()
{
$server = static::getServer();
$this->assertTrue($server->hasMailBox('Cheese'), 'Does have mailbox "Cheese"');
$this->assertTrue($server->deleteMailBox('Cheese'), 'deleteMailBox returns true.');
$this->assertFalse($server->hasMailBox('Cheese'), 'Mailbox "Cheese" was deleted');
}
/**
* @expectedException \RuntimeException
*/