Permalink
Browse files

Wrap the teardown to prevent fatal errors when the fixture is not set.

  • Loading branch information...
1 parent 1fadec1 commit bfe04b25fb31a4201f7082736231685973028090 Graham Christensen committed Jun 6, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 tests/IMAPTest.php
View
@@ -74,17 +74,19 @@ protected function setUp()
protected function tearDown()
{
- // delete all mailboxes except INBOX
- $mailboxes = $this->fixture->getMailboxes();
- foreach ($mailboxes as $mailbox) {
- if (in_array($mailbox, $this->reservedFolders)) {
- continue;
+ if ($this->fixture) {
+ // delete all mailboxes except INBOX
+ $mailboxes = $this->fixture->getMailboxes();
+ foreach ($mailboxes as $mailbox) {
+ if (in_array($mailbox, $this->reservedFolders)) {
+ continue;
+ }
+ $this->fixture->deleteMailbox($mailbox);
}
- $this->fixture->deleteMailbox($mailbox);
- }
- // delete instance
- unset($this->fixture);
+ // delete instance
+ unset($this->fixture);
+ }
}
protected function login()

0 comments on commit bfe04b2

Please sign in to comment.