Avoiding circular object reference in SmptTransport

This fixes a memory leak while sending multiple emails.

Fixes: #9198
This commit is contained in:
Juan I. Benavides 2016-08-01 13:09:45 -05:00
parent 774af90830
commit 93db51cf10
2 changed files with 23 additions and 46 deletions

View file

@ -35,16 +35,6 @@ class SmtpTestTransport extends SmtpTransport {
$this->_socket = $socket;
}
/**
* Helper to change the CakeEmail
*
* @param object $cakeEmail An email object.
* @return void
*/
public function setCakeEmail($cakeEmail) {
$this->_cakeEmail = $cakeEmail;
}
/**
* Disabled the socket change
*
@ -348,8 +338,7 @@ class SmtpTransportTest extends CakeTestCase {
$this->socket->expects($this->at(13))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(14))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->SmtpTransport->setCakeEmail($email);
$this->SmtpTransport->sendRcpt();
$this->SmtpTransport->sendRcpt($email);
}
/**
@ -370,8 +359,7 @@ class SmtpTransportTest extends CakeTestCase {
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->SmtpTransport->setCakeEmail($email);
$this->SmtpTransport->sendRcpt();
$this->SmtpTransport->sendRcpt($email);
}
/**
@ -416,8 +404,7 @@ class SmtpTransportTest extends CakeTestCase {
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->SmtpTransport->setCakeEmail($email);
$this->SmtpTransport->sendData();
$this->SmtpTransport->sendData($email);
}
/**
@ -498,8 +485,7 @@ class SmtpTransportTest extends CakeTestCase {
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->SmtpTransport->setCakeEmail($email);
$this->SmtpTransport->sendRcpt();
$this->SmtpTransport->sendRcpt($email);
$expected = array(
array('code' => '250', 'message' => 'OK'),