aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php')
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
new file mode 100644
index 00000000..73c602c5
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
@@ -0,0 +1,48 @@
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
12namespace Symfony\Component\Form\Tests;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class 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}