Skip to content

Commit 191703b

Browse files
minor #52400 [Process] Fix memory limit in PhpSubprocess test (ausi)
This PR was merged into the 6.4 branch. Discussion ---------- [Process] Fix memory limit in `PhpSubprocess` test | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT If your local `memory_limit` php configuration differs from the setting in the *phpunit.xml.dist* file https://github.com/symfony/symfony/blob/f46299957cd6d7f83e3ed62f890db20674f22ee0/phpunit.xml.dist#L15 the test always fails as the *src/Symfony/Component/Process/Tests/Fixtures/memory.php* file does not load the phpunit config. /cc `@Toflar` Commits ------- f8148489101 Fix memory limit in PhpSubprocess unit test
2 parents a91571f + 146e8ea commit 191703b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tests/PhpSubprocessTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function subprocessProvider(): \Generator
4747
yield 'Process does ignore dynamic memory_limit' => [
4848
'Process',
4949
self::getRandomMemoryLimit(),
50-
self::getCurrentMemoryLimit(),
50+
self::getDefaultMemoryLimit(),
5151
];
5252

5353
yield 'PhpSubprocess does not ignore dynamic memory_limit' => [
@@ -57,16 +57,16 @@ public static function subprocessProvider(): \Generator
5757
];
5858
}
5959

60-
private static function getCurrentMemoryLimit(): string
60+
private static function getDefaultMemoryLimit(): string
6161
{
62-
return trim(\ini_get('memory_limit'));
62+
return trim(ini_get_all()['memory_limit']['global_value']);
6363
}
6464

6565
private static function getRandomMemoryLimit(): string
6666
{
6767
$memoryLimit = 123; // Take something that's really unlikely to be configured on a user system.
6868

69-
while (($formatted = $memoryLimit.'M') === self::getCurrentMemoryLimit()) {
69+
while (($formatted = $memoryLimit.'M') === self::getDefaultMemoryLimit()) {
7070
++$memoryLimit;
7171
}
7272

0 commit comments

Comments
 (0)