@@ -1081,21 +1081,23 @@ public function testSetPath(): void
10811081 $ this ->assertSame ('foobar ' , $ request ->getPath ());
10821082 }
10831083
1084- #[DataProvider('provideParsePostMaxSize ' )]
1085- public function testParsePostMaxSize (string $ value , int $ expected ): void
1084+ #[DataProvider('provideGetPostMaxSize ' )]
1085+ public function testGetPostMaxSize (string $ value , int $ expected ): void
10861086 {
1087- $ parsePostMaxSize = $ this ->getPrivateMethodInvoker ($ this ->request , 'parsePostMaxSize ' );
1087+ $ getPostMaxSize = $ this ->getPrivateMethodInvoker ($ this ->request , 'getPostMaxSize ' );
10881088
1089- $ this ->assertSame ($ expected , $ parsePostMaxSize ($ value ));
1089+ $ this ->assertSame ($ expected , $ getPostMaxSize ($ value ));
10901090 }
10911091
10921092 /**
10931093 * @return iterable<array{string, int}>
10941094 */
1095- public static function provideParsePostMaxSize (): iterable
1095+ public static function provideGetPostMaxSize (): iterable
10961096 {
10971097 yield 'zero means unlimited ' => ['0 ' , PHP_INT_MAX ];
10981098
1099+ yield 'zero with suffix means unlimited ' => ['0K ' , PHP_INT_MAX ];
1100+
10991101 yield 'negative means unlimited ' => ['-1 ' , PHP_INT_MAX ];
11001102
11011103 yield 'gigabytes ' => ['1G ' , 1024 ** 3 ];
@@ -1119,6 +1121,16 @@ public static function provideParsePostMaxSize(): iterable
11191121 yield 'bytes ' => ['12345 ' , 12345 ];
11201122 }
11211123
1124+ public function testGetPostMaxSizeDefault (): void
1125+ {
1126+ $ getPostMaxSize = $ this ->getPrivateMethodInvoker ($ this ->request , 'getPostMaxSize ' );
1127+
1128+ $ bytes = ini_parse_quantity ((string ) ini_get ('post_max_size ' ));
1129+ $ expected = $ bytes <= 0 ? PHP_INT_MAX : $ bytes ;
1130+
1131+ $ this ->assertSame ($ expected , $ getPostMaxSize ());
1132+ }
1133+
11221134 public function testGetIPAddressNormal (): void
11231135 {
11241136 $ expected = '123.123.123.123 ' ;
0 commit comments