mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
6c754d29e9
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79438 467b73ca-7a2a-4603-9d3b-597d59a354a9
38 lines
882 B
PHP
38 lines
882 B
PHP
<?php
|
|
|
|
class MemoryLimitTest extends SapphireTest {
|
|
|
|
function testIncreaseMemoryLimitTo() {
|
|
ini_set('memory_limit', '64M');
|
|
|
|
// It can go up
|
|
increase_memory_limit_to('128M');
|
|
$this->assertEquals('128M', ini_get('memory_limit'));
|
|
|
|
// But not down
|
|
increase_memory_limit_to('64M');
|
|
$this->assertEquals('128M', ini_get('memory_limit'));
|
|
|
|
// Test the different kinds of syntaxes
|
|
increase_memory_limit_to(1024*1024*200);
|
|
$this->assertEquals(1024*1024*200, ini_get('memory_limit'));
|
|
|
|
increase_memory_limit_to('409600K');
|
|
$this->assertEquals('409600K', ini_get('memory_limit'));
|
|
|
|
increase_memory_limit_to('1G');
|
|
$this->assertEquals('1G', ini_get('memory_limit'));
|
|
}
|
|
|
|
|
|
///////////////////
|
|
|
|
private $origLimit;
|
|
|
|
function setUp() {
|
|
$this->origLimit = ini_get('memory_limit');
|
|
}
|
|
function tearDown() {
|
|
ini_set('memory_limit', $this->origLimit);
|
|
}
|
|
} |