mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #12466 from bancer/2.x-tear-down
Free some memory in unit tests
This commit is contained in:
commit
4b71666255
2 changed files with 18 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue