Merge pull request #12466 from bancer/2.x-tear-down

Free some memory in unit tests
This commit is contained in:
Mark Story 2018-08-14 14:36:42 -04:00 committed by GitHub
commit 4b71666255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -84,6 +84,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
$result = parent::run($result);
if (!empty($this->fixtureManager)) {
$this->fixtureManager->unload($this);
unset($this->fixtureManager, $this->db);
}
for ($i = ob_get_level(); $i < $level; ++$i) {
@ -164,6 +165,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
if (isset($_GET['debug']) && $_GET['debug']) {
ob_flush();
}
unset($this->_configure, $this->_pathRestore);
}
/**

View file

@ -418,4 +418,20 @@ abstract class ControllerTestCase extends CakeTestCase {
return $this->controller;
}
/**
* Unsets some properties to free memory.
*
* @return void
*/
public function tearDown() {
parent::tearDown();
unset(
$this->contents,
$this->controller,
$this->headers,
$this->result,
$this->view,
$this->vars
);
}
}