]>
Commit | Line | Data |
---|---|---|
4f5b44bd NL |
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; | |
13 | ||
14 | /** | |
15 | * @author Bernhard Schussek <bschussek@gmail.com> | |
16 | */ | |
17 | class CompoundFormPerformanceTest extends \Symfony\Component\Form\Tests\FormPerformanceTestCase | |
18 | { | |
19 | /** | |
20 | * Create a compound form multiple times, as happens in a collection form | |
21 | * | |
22 | * @group benchmark | |
23 | */ | |
24 | public function testArrayBasedForm() | |
25 | { | |
26 | $this->setMaxRunningTime(1); | |
27 | ||
28 | for ($i = 0; $i < 40; ++$i) { | |
29 | $form = $this->factory->createBuilder('form') | |
30 | ->add('firstName', 'text') | |
31 | ->add('lastName', 'text') | |
32 | ->add('gender', 'choice', array( | |
33 | 'choices' => array('male' => 'Male', 'female' => 'Female'), | |
34 | 'required' => false, | |
35 | )) | |
36 | ->add('age', 'number') | |
37 | ->add('birthDate', 'birthday') | |
38 | ->add('city', 'choice', array( | |
39 | // simulate 300 different cities | |
40 | 'choices' => range(1, 300), | |
41 | )) | |
42 | ->getForm(); | |
43 | ||
44 | // load the form into a view | |
45 | $form->createView(); | |
46 | } | |
47 | } | |
48 | } |