mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Ensured resetting previous memory limit in after test has run.
This commit is contained in:
parent
215f1c381e
commit
6c9ea71e24
@ -3,12 +3,19 @@ namespace Psalm\Tests\Functions;
|
||||
|
||||
use function getMemoryLimitInBytes;
|
||||
use function ini_set;
|
||||
use function ini_get;
|
||||
|
||||
class GetMemoryLimitInBytesTest extends \Psalm\Tests\TestCase
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $previousLimit;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
require_once 'src/command_functions.php';
|
||||
$this->previousLimit = (string)ini_get('memory_limit');
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
@ -56,4 +63,10 @@ class GetMemoryLimitInBytesTest extends \Psalm\Tests\TestCase
|
||||
ini_set('memory_limit', (string)$setting);
|
||||
$this->assertSame($expectedBytes, getMemoryLimitInBytes(), 'Memory limit in bytes does not fit setting');
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
ini_set('memory_limit', $this->previousLimit);
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user