4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Form\Tests\Extension\Validator\Util
;
14 class ServerParamsTest
extends \PHPUnit_Framework_TestCase
16 /** @dataProvider getGetPostMaxSizeTestData */
17 public function testGetPostMaxSize($size, $bytes)
19 $serverParams = $this->getMock('Symfony\Component\Form\Extension\Validator\Util\ServerParams', array('getNormalizedIniPostMaxSize'));
21 ->expects($this->any())
22 ->method('getNormalizedIniPostMaxSize')
23 ->will($this->returnValue(strtoupper($size)));
25 $this->assertEquals($bytes, $serverParams->getPostMaxSize());
28 public function getGetPostMaxSizeTestData()
33 array('8m', 8 * 1024 * 1024),
35 array('+2???k', 2048),
39 array('+0x10 k', 16 * 1024),
40 array('1g', 1024 * 1024 * 1024),
43 array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm'