BUGFIX Disabled MemoryLimitTest for environments where memory_limit can't be freely set (e.g. PHP with suhosin patch) (from r103910)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112323 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-14 23:51:03 +00:00
parent d46c3c877f
commit 28a7b03bef

View File

@ -3,6 +3,8 @@
class MemoryLimitTest extends SapphireTest {
function testIncreaseMemoryLimitTo() {
if(!$this->canChangeMemory()) return;
ini_set('memory_limit', '64M');
// It can go up
@ -34,6 +36,8 @@ class MemoryLimitTest extends SapphireTest {
}
function testIncreaseTimeLimitTo() {
if(!$this->canChangeMemory()) return;
set_time_limit(6000);
// It can go up
@ -67,4 +71,18 @@ class MemoryLimitTest extends SapphireTest {
ini_set('memory_limit', $this->origMemLimit);
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;
}
}