mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add test for #7224
This commit is contained in:
parent
7bbdcb207b
commit
f2f8f3f1ea
1 changed files with 32 additions and 0 deletions
|
@ -829,4 +829,36 @@ class AppTest extends CakeTestCase {
|
|||
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
|
||||
*/
|
||||
public function memoryVariationProvider() {
|
||||
return array(
|
||||
array('131072K', 100000, '231072K'),
|
||||
array('256M', 1, '262145K'),
|
||||
array('1G', 1, '1048577K'),
|
||||
array('-1', 100000, -1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue