Skip to content

Commit

Permalink
Merge pull request #135 from tedious/delete_mailbox
Browse files Browse the repository at this point in the history
Added delete mailbox method
  • Loading branch information
tedivm committed Jun 7, 2015
2 parents eb76a80 + 1ca08ba commit db525ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Fetch/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,4 +485,16 @@ public function listMailBoxes($pattern = '*')
{
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);
}
}
8 changes: 8 additions & 0 deletions tests/Fetch/Test/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ public function testCreateMailbox()
$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
*/
Expand Down

0 comments on commit db525ae

Please sign in to comment.