MNT Adjust a couple of unit tests to run from recipe-kitchen-sink

This commit is contained in:
Steve Boyd 2021-11-16 12:55:00 +13:00
parent 29fa365d10
commit 081537d014
2 changed files with 12 additions and 11 deletions

View File

@ -44,28 +44,29 @@ class MemoryLimitTest extends SapphireTest
{ {
// ini_set('memory_limit', '64M'); // ini_set('memory_limit', '64M');
// current memory usage in travis is 197M, can't ini_set this down to 64M // current memory usage in travis is 197M, can't ini_set this down to 64M
// for recipe-kitchen-sink, it's 284M
// Using a higher memory limit instead // Using a higher memory limit instead
ini_set('memory_limit', '230M'); ini_set('memory_limit', '330M');
Environment::setMemoryLimitMax('256M'); Environment::setMemoryLimitMax('512M');
// It can go up // It can go up
Environment::increaseMemoryLimitTo('240M'); Environment::increaseMemoryLimitTo('340M');
$this->assertEquals('240M', ini_get('memory_limit')); $this->assertEquals('340M', ini_get('memory_limit'));
// But not down // But not down
Environment::increaseMemoryLimitTo('220M'); Environment::increaseMemoryLimitTo('320M');
$this->assertEquals('240M', ini_get('memory_limit')); $this->assertEquals('340M', ini_get('memory_limit'));
// Test the different kinds of syntaxes // Test the different kinds of syntaxes
Environment::increaseMemoryLimitTo(1024*1024*250); Environment::increaseMemoryLimitTo(1024*1024*350);
$this->assertEquals('250M', ini_get('memory_limit')); $this->assertEquals('350M', ini_get('memory_limit'));
Environment::increaseMemoryLimitTo('109600K'); Environment::increaseMemoryLimitTo('109600K');
$this->assertEquals('250M', ini_get('memory_limit')); $this->assertEquals('350M', ini_get('memory_limit'));
// Attempting to increase past max size only sets to max // Attempting to increase past max size only sets to max
Environment::increaseMemoryLimitTo('1G'); Environment::increaseMemoryLimitTo('1G');
$this->assertEquals('256M', ini_get('memory_limit')); $this->assertEquals('512M', ini_get('memory_limit'));
// No argument means unlimited (but only if originally allowed) // No argument means unlimited (but only if originally allowed)
if (is_numeric($this->origMemLimitMax) && $this->origMemLimitMax < 0) { if (is_numeric($this->origMemLimitMax) && $this->origMemLimitMax < 0) {

View File

@ -23,7 +23,7 @@ class DetailedErrorFormatterTest extends SapphireTest
$this->assertStringContainsString("Line 32 in $base/DetailedErrorFormatterTest/ErrorGenerator.php", $output); $this->assertStringContainsString("Line 32 in $base/DetailedErrorFormatterTest/ErrorGenerator.php", $output);
$this->assertStringContainsString('* 32: throw new Exception(\'Error\');', $output); $this->assertStringContainsString('* 32: throw new Exception(\'Error\');', $output);
$this->assertStringContainsString( $this->assertStringContainsString(
'SilverStripe\\Logging\\Tests\\DetailedErrorFormatterTest\\ErrorGenerator->mockException(4)', 'SilverStripe\\Logging\\Tests\\DetailedErrorFormatterTest\\ErrorGenerator->mockException',
$output $output
); );
} }