-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged branch jfsimon/issue-7480 (PR #7481)
This PR was merged into the master branch. Discussion ---------- [Form] fixes ServerParams::getPostMaxSize() regex pattern | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #7480 Commits ------- 84541e7 [Form] fixed ServerParams::getPostMaxSize() regex pattern
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Form\Tests\Extension\Validator\Util; | ||
|
||
class ServerParamsTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** @dataProvider getGetPostMaxSizeTestData */ | ||
public function testGetPostMaxSize($size, $bytes) | ||
{ | ||
$serverParams = $this->getMock('Symfony\Component\Form\Extension\Validator\Util\ServerParams', array('getNormalizedIniPostMaxSize')); | ||
$serverParams | ||
->expects($this->any()) | ||
->method('getNormalizedIniPostMaxSize') | ||
->will($this->returnValue(strtoupper($size))); | ||
|
||
$this->assertEquals($bytes, $serverParams->getPostMaxSize()); | ||
} | ||
|
||
public function getGetPostMaxSizeTestData() | ||
{ | ||
return array( | ||
array('2k', 2048), | ||
array('2 k', 2048), | ||
array('+2 k', 2048), | ||
array('+2???k', 2048), | ||
array('0x10', 16), | ||
array('0xf', 15), | ||
array('010', 8), | ||
array('+0x10 k', 16 * 1024), | ||
array('1g', 1024 * 1024 * 1024), | ||
); | ||
} | ||
} |