Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions tests/http/stateless/ApplicationMemoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function testClearOutputCleansLocalBuffers(): void
/**
* @throws InvalidConfigException if the configuration is invalid or incomplete.
*/
public function testGetMemoryLimitHandlesUnlimitedMemoryCorrectly(): void
public function testMemoryLimitHandlesUnlimitedValues(): void
{
$originalLimit = ini_get('memory_limit');

Expand All @@ -179,39 +179,16 @@ public function testGetMemoryLimitHandlesUnlimitedMemoryCorrectly(): void
self::assertSame(
PHP_INT_MAX,
$app->getMemoryLimit(),
"Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited) in 'StatelessApplication'.",
"Before 'handle()' memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited).",
);

$app->handle(FactoryHelper::createServerRequestCreator()->createFromGlobals());
$app->clean();

ini_set('memory_limit', $originalLimit);
}

/**
* @throws InvalidConfigException if the configuration is invalid or incomplete.
*/
public function testReturnPhpIntMaxWhenMemoryLimitIsUnlimited(): void
{
$originalLimit = ini_get('memory_limit');

ini_set('memory_limit', '-1');

$app = $this->statelessApplication();

$app->handle(FactoryHelper::createServerRequestCreator()->createFromGlobals());

self::assertSame(
PHP_INT_MAX,
$app->getMemoryLimit(),
"'getMemoryLimit()' should return 'PHP_INT_MAX' when 'memory_limit' is set to '-1' (unlimited) in " .
"'StatelessApplication'.",
);
self::assertSame(
PHP_INT_MAX,
$app->getMemoryLimit(),
"'getMemoryLimit()' should remain 'PHP_INT_MAX' after handling a request with unlimited memory in " .
"'StatelessApplication'.",
"After 'clean()' memory limit should remain 'PHP_INT_MAX' when set to '-1'.",
);

ini_set('memory_limit', $originalLimit);
Expand Down
Loading