Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Added disconnect() to Zend\Mail\Transport\Smtp
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed May 7, 2012
1 parent e156ae5 commit 1294389
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Transport/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,17 @@ public function getConnection()
{
return $this->connection;
}

/**
* Disconnect the connection protocol instance
*
* @return void
*/
public function disconnect()
{
if (!empty($this->connection) && ($this->connection instanceof Protocol\Smtp)) {
$this->connection->disconnect();
}
}
/**
* Send an email via the SMTP connection protocol
*
Expand Down
8 changes: 8 additions & 0 deletions test/Transport/SmtpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,12 @@ public function testAutoDisconnectFalse()
unset($this->transport);
$this->assertTrue($this->connection->isConnected());
}

public function testDisconnect()
{
$this->connection->connect();
$this->assertTrue($this->connection->isConnected());
$this->transport->disconnect();
$this->assertFalse($this->connection->isConnected());
}
}

0 comments on commit 1294389

Please sign in to comment.