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

Commit

Permalink
Merge branch 'hotfix/3645' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Protocol/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,18 @@ public function auth()
*/
public function disconnect()
{
$this->quit();
$this->_disconnect();
}

/**
* Disconnect from remote host and free resource
*/
protected function _disconnect()
{
// Make sure the session gets closed
$this->quit();
parent::_disconnect();
}

/**
* Start mail session
Expand Down
6 changes: 6 additions & 0 deletions test/Protocol/SmtpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,10 @@ public function testSendMinimalMail()

$this->assertEquals($expectedMessage, $this->connection->getLog());
}

public function testDisconnectCallsQuit()
{
$this->connection->disconnect();
$this->assertTrue($this->connection->calledQuit);
}
}
2 changes: 2 additions & 0 deletions test/TestAsset/SmtpProtocolSpy.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
class SmtpProtocolSpy extends Smtp
{
public $calledQuit = false;
protected $connect = false;
protected $mail;
protected $rcptTest = array();
Expand All @@ -44,6 +45,7 @@ public function helo($serverName = '127.0.0.1')

public function quit()
{
$this->calledQuit = true;
parent::quit();
}

Expand Down

0 comments on commit 71822ef

Please sign in to comment.