mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Disabled MemoryLimitTest for environments where memory_limit can't be freely set (e.g. PHP with suhosin patch)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@103910 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
83efb8bb63
commit
661dc6c22c
@ -3,6 +3,8 @@
|
|||||||
class MemoryLimitTest extends SapphireTest {
|
class MemoryLimitTest extends SapphireTest {
|
||||||
|
|
||||||
function testIncreaseMemoryLimitTo() {
|
function testIncreaseMemoryLimitTo() {
|
||||||
|
if(!$this->canChangeMemory()) return;
|
||||||
|
|
||||||
ini_set('memory_limit', '64M');
|
ini_set('memory_limit', '64M');
|
||||||
|
|
||||||
// It can go up
|
// It can go up
|
||||||
@ -34,6 +36,8 @@ class MemoryLimitTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testIncreaseTimeLimitTo() {
|
function testIncreaseTimeLimitTo() {
|
||||||
|
if(!$this->canChangeMemory()) return;
|
||||||
|
|
||||||
set_time_limit(6000);
|
set_time_limit(6000);
|
||||||
|
|
||||||
// It can go up
|
// It can go up
|
||||||
@ -67,4 +71,18 @@ class MemoryLimitTest extends SapphireTest {
|
|||||||
ini_set('memory_limit', $this->origMemLimit);
|
ini_set('memory_limit', $this->origMemLimit);
|
||||||
set_time_limit($this->origTimeLimit);
|
set_time_limit($this->origTimeLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines wether the environment generally allows
|
||||||
|
* to change the memory limits, which is not always the case.
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
protected function canChangeMemory() {
|
||||||
|
$exts = get_loaded_extensions();
|
||||||
|
// see http://www.hardened-php.net/suhosin/configuration.html#suhosin.memory_limit
|
||||||
|
if(in_array('suhosin', $exts)) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user