Skip to content

Commit a45ebbe

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Finder] Fix gitignore regex build with "**" Fixed deprecation warnings about passing null as parameter [Security] Keep Bulgarian wording consistent across all texts. Migrate configuration file for PHP CS Fixer 2.19/3.0 [Form] Replace broken ServerParams mock
2 parents 10279a7 + cad7609 commit a45ebbe

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Tests/AbstractRequestHandlerTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,21 @@ abstract class AbstractRequestHandlerTest extends TestCase
4444

4545
protected function setUp(): void
4646
{
47-
$this->serverParams = $this->getMockBuilder(ServerParams::class)->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
47+
$this->serverParams = new class() extends ServerParams {
48+
public $contentLength;
49+
public $postMaxSize = '';
50+
51+
public function getContentLength(): ?int
52+
{
53+
return $this->contentLength;
54+
}
55+
56+
public function getNormalizedIniPostMaxSize(): string
57+
{
58+
return $this->postMaxSize;
59+
}
60+
};
61+
4862
$this->requestHandler = $this->getRequestHandler();
4963
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
5064
$this->request = null;
@@ -310,14 +324,10 @@ public function testSubmitFileWithNamelessForm($method)
310324
/**
311325
* @dataProvider getPostMaxSizeFixtures
312326
*/
313-
public function testAddFormErrorIfPostMaxSizeExceeded($contentLength, $iniMax, $shouldFail, array $errorParams = [])
327+
public function testAddFormErrorIfPostMaxSizeExceeded(?int $contentLength, string $iniMax, bool $shouldFail, array $errorParams = [])
314328
{
315-
$this->serverParams->expects($this->once())
316-
->method('getContentLength')
317-
->willReturn($contentLength);
318-
$this->serverParams->expects($this->any())
319-
->method('getNormalizedIniPostMaxSize')
320-
->willReturn($iniMax);
329+
$this->serverParams->contentLength = $contentLength;
330+
$this->serverParams->postMaxSize = $iniMax;
321331

322332
$options = ['post_max_size_message' => 'Max {{ max }}!'];
323333
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, $options);

0 commit comments

Comments
 (0)