Skip to content

Commit

Permalink
Merge pull request #7755 from chinpei215/2.8-test-for-7224
Browse files Browse the repository at this point in the history
Add test for #7224
  • Loading branch information
markstory committed Nov 30, 2015
2 parents 7bbdcb2 + 415661b commit 6e44930
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/Cake/Test/Case/Core/AppTest.php
Expand Up @@ -829,4 +829,36 @@ public function testPluginLibClasses() {
App::uses('TestPluginOtherLibrary', 'TestPlugin.Lib');
$this->assertTrue(class_exists('TestPluginOtherLibrary'));
}

/**
* Test that increaseMemoryLimit increases the maximum amount of memory actually
*
* @dataProvider memoryVariationProvider
* @return void
*/
public function testIncreaseMemoryLimit($memoryLimit, $additionalKb, $expected) {
$this->skipIf(!function_exists('ini_set'));

$originalMemoryLimit = ini_get('memory_limit');

ini_set('memory_limit', $memoryLimit);
App::increaseMemoryLimit($additionalKb);
$this->assertEquals($expected, ini_get('memory_limit'));

ini_set('memory_limit', $originalMemoryLimit);
}

/**
* Data provider function for testIncreaseMemoryLimit
*
* @return void
*/
public function memoryVariationProvider() {
return array(
array('131072K', 100000, '231072K'),
array('256M', 1, '262145K'),
array('1G', 1, '1048577K'),
array('-1', 100000, '-1')
);
}
}

0 comments on commit 6e44930

Please sign in to comment.