From 526863bf35bcb383d2b1a51b0e2bd087ccf44e17 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Sat, 23 Aug 2025 07:40:04 -0400 Subject: [PATCH 1/2] test(http): Rename test method for clarity and remove redundant test for unlimited memory limit in `ApplicationMemoryTest` class. --- .../http/stateless/ApplicationMemoryTest.php | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/tests/http/stateless/ApplicationMemoryTest.php b/tests/http/stateless/ApplicationMemoryTest.php index 9e97d1e4..759ca2bf 100644 --- a/tests/http/stateless/ApplicationMemoryTest.php +++ b/tests/http/stateless/ApplicationMemoryTest.php @@ -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'); @@ -185,33 +185,10 @@ public function testGetMemoryLimitHandlesUnlimitedMemoryCorrectly(): void $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'.", + "Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited) in 'StatelessApplication'.", ); ini_set('memory_limit', $originalLimit); From 3e27c723c45eac1bcf346f39cb5e07008c2d618e Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Sat, 23 Aug 2025 07:55:09 -0400 Subject: [PATCH 2/2] Apply fixed review coderabbitai nitpick comments. --- tests/http/stateless/ApplicationMemoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/http/stateless/ApplicationMemoryTest.php b/tests/http/stateless/ApplicationMemoryTest.php index 759ca2bf..658a8b44 100644 --- a/tests/http/stateless/ApplicationMemoryTest.php +++ b/tests/http/stateless/ApplicationMemoryTest.php @@ -179,7 +179,7 @@ public function testMemoryLimitHandlesUnlimitedValues(): 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()); @@ -188,7 +188,7 @@ public function testMemoryLimitHandlesUnlimitedValues(): void self::assertSame( PHP_INT_MAX, $app->getMemoryLimit(), - "Memory limit should be 'PHP_INT_MAX' when set to '-1' (unlimited) in 'StatelessApplication'.", + "After 'clean()' memory limit should remain 'PHP_INT_MAX' when set to '-1'.", ); ini_set('memory_limit', $originalLimit);