mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #7755 from chinpei215/2.8-test-for-7224
Add test for #7224
This commit is contained in:
commit
6e44930690
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 void
|
||||
*/
|
||||
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