diff options
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php new file mode 100644 index 00000000..7ad5b771 --- /dev/null +++ b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php | |||
@@ -0,0 +1,46 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Form\Tests\Extension\Validator\Util; | ||
13 | |||
14 | class ServerParamsTest extends \PHPUnit_Framework_TestCase | ||
15 | { | ||
16 | /** @dataProvider getGetPostMaxSizeTestData */ | ||
17 | public function testGetPostMaxSize($size, $bytes) | ||
18 | { | ||
19 | $serverParams = $this->getMock('Symfony\Component\Form\Extension\Validator\Util\ServerParams', array('getNormalizedIniPostMaxSize')); | ||
20 | $serverParams | ||
21 | ->expects($this->any()) | ||
22 | ->method('getNormalizedIniPostMaxSize') | ||
23 | ->will($this->returnValue(strtoupper($size))); | ||
24 | |||
25 | $this->assertEquals($bytes, $serverParams->getPostMaxSize()); | ||
26 | } | ||
27 | |||
28 | public function getGetPostMaxSizeTestData() | ||
29 | { | ||
30 | return array( | ||
31 | array('2k', 2048), | ||
32 | array('2 k', 2048), | ||
33 | array('8m', 8 * 1024 * 1024), | ||
34 | array('+2 k', 2048), | ||
35 | array('+2???k', 2048), | ||
36 | array('0x10', 16), | ||
37 | array('0xf', 15), | ||
38 | array('010', 8), | ||
39 | array('+0x10 k', 16 * 1024), | ||
40 | array('1g', 1024 * 1024 * 1024), | ||
41 | array('-1', -1), | ||
42 | array('0', 0), | ||
43 | array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm' | ||
44 | ); | ||
45 | } | ||
46 | } | ||