File tree Expand file tree Collapse file tree 9 files changed +123
-81
lines changed
Expand file tree Collapse file tree 9 files changed +123
-81
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ CHANGELOG
552.3.0
66------
77
8- * deprecated TypeTestCase in the Symfony\Component\Form\Tests\Extension\Core\Type namespace and moved it to the Symfony\Component\Form\Test namespace.
8+ * deprecated FormPerformanceTestCase and FormIntegrationTestCase in the Symfony\Component\Form\Tests namespace and moved them to the Symfony\Component\Form\Test namespace
9+ * deprecated TypeTestCase in the Symfony\Component\Form\Tests\Extension\Core\Type namespace and moved it to the Symfony\Component\Form\Test namespace
910 * changed FormRenderer::humanize() to humanize also camel cased field name
1011 * added FormProcessorInterface and FormInterface::process()
1112 * deprecated passing a Request instance to FormInterface::bind()
Original file line number Diff line number Diff line change 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 \Test ;
13+
14+ use Symfony \Component \Form \Forms ;
15+
16+ /**
17+ * @author Bernhard Schussek <bschussek@gmail.com>
18+ */
19+ abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
20+ {
21+ /**
22+ * @var \Symfony\Component\Form\FormFactoryInterface
23+ */
24+ protected $ factory ;
25+
26+ protected function setUp ()
27+ {
28+ if (!class_exists ('Symfony\Component\EventDispatcher\EventDispatcher ' )) {
29+ $ this ->markTestSkipped ('The "EventDispatcher" component is not available ' );
30+ }
31+
32+ $ this ->factory = Forms::createFormFactoryBuilder ()
33+ ->addExtensions ($ this ->getExtensions ())
34+ ->getFormFactory ();
35+ }
36+
37+ protected function getExtensions ()
38+ {
39+ return array ();
40+ }
41+ }
Original file line number Diff line number Diff line change 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 \Test ;
13+
14+ /**
15+ * Base class for performance tests.
16+ *
17+ * Copied from Doctrine 2's OrmPerformanceTestCase.
18+ *
19+ * @author robo
20+ * @author Bernhard Schussek <bschussek@gmail.com>
21+ */
22+ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
23+ {
24+ /**
25+ * @var integer
26+ */
27+ protected $ maxRunningTime = 0 ;
28+
29+ /**
30+ */
31+ protected function runTest ()
32+ {
33+ $ s = microtime (true );
34+ parent ::runTest ();
35+ $ time = microtime (true ) - $ s ;
36+
37+ if ($ this ->maxRunningTime != 0 && $ time > $ this ->maxRunningTime ) {
38+ $ this ->fail (
39+ sprintf (
40+ 'expected running time: <= %s but was: %s ' ,
41+
42+ $ this ->maxRunningTime ,
43+ $ time
44+ )
45+ );
46+ }
47+ }
48+
49+ /**
50+ * @param integer $maxRunningTime
51+ * @throws \InvalidArgumentException
52+ */
53+ public function setMaxRunningTime ($ maxRunningTime )
54+ {
55+ if (is_integer ($ maxRunningTime ) && $ maxRunningTime >= 0 ) {
56+ $ this ->maxRunningTime = $ maxRunningTime ;
57+ } else {
58+ throw new \InvalidArgumentException ;
59+ }
60+ }
61+
62+ /**
63+ * @return integer
64+ * @since Method available since Release 2.3.0
65+ */
66+ public function getMaxRunningTime ()
67+ {
68+ return $ this ->maxRunningTime ;
69+ }
70+ }
Original file line number Diff line number Diff line change 1212namespace Symfony \Component \Form \Test ;
1313
1414use Symfony \Component \Form \FormBuilder ;
15- use Symfony \Component \Form \Tests \FormIntegrationTestCase ;
1615use Symfony \Component \EventDispatcher \EventDispatcher ;
1716
1817abstract class TypeTestCase extends FormIntegrationTestCase
Original file line number Diff line number Diff line change 1515use Symfony \Component \Form \FormView ;
1616use Symfony \Component \Form \Extension \Csrf \CsrfExtension ;
1717
18- abstract class AbstractLayoutTest extends FormIntegrationTestCase
18+ abstract class AbstractLayoutTest extends \ Symfony \ Component \ Form \ Test \ FormIntegrationTestCase
1919{
2020 protected $ csrfProvider ;
2121
Original file line number Diff line number Diff line change 1414/**
1515 * @author Bernhard Schussek <bschussek@gmail.com>
1616 */
17- class CompoundFormPerformanceTest extends FormPerformanceTestCase
17+ class CompoundFormPerformanceTest extends \ Symfony \ Component \ Form \ Tests \ FormPerformanceTestCase
1818{
1919 /**
2020 * Create a compound form multiple times, as happens in a collection form
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \Form \Tests \Extension \Core \Type ;
1313
14- use Symfony \Component \Form \Tests \FormPerformanceTestCase ;
14+ use Symfony \Component \Form \Test \FormPerformanceTestCase ;
1515
1616/**
1717 * @author Bernhard Schussek <bschussek@gmail.com>
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \Form \Tests ;
1313
14- use Symfony \Component \Form \Forms ;
14+ use Symfony \Component \Form \Test \ FormIntegrationTestCase as BaseFormIntegrationTestCase ;
1515
1616/**
17- * @author Bernhard Schussek <bschussek@gmail.com>
17+ * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\FormIntegrationTestCase instead.
1818 */
19- abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
19+ abstract class FormIntegrationTestCase extends BaseFormIntegrationTestCase
2020{
21- /**
22- * @var \Symfony\Component\Form\FormFactoryInterface
23- */
24- protected $ factory ;
25-
26- protected function setUp ()
27- {
28- if (!class_exists ('Symfony\Component\EventDispatcher\EventDispatcher ' )) {
29- $ this ->markTestSkipped ('The "EventDispatcher" component is not available ' );
30- }
31-
32- $ this ->factory = Forms::createFormFactoryBuilder ()
33- ->addExtensions ($ this ->getExtensions ())
34- ->getFormFactory ();
35- }
36-
37- protected function getExtensions ()
38- {
39- return array ();
40- }
4121}
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \Form \Tests ;
1313
14+ use Symfony \Component \Form \Test \FormPerformanceTestCase as BaseFormPerformanceTestCase ;
15+
1416/**
15- * Base class for performance tests.
16- *
17- * Copied from Doctrine 2's OrmPerformanceTestCase.
18- *
19- * @author robo
20- * @author Bernhard Schussek <bschussek@gmail.com>
17+ * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\FormPerformanceTestCase instead.
2118 */
22- abstract class FormPerformanceTestCase extends FormIntegrationTestCase
19+ abstract class FormPerformanceTestCase extends BaseFormPerformanceTestCase
2320{
24- /**
25- * @var integer
26- */
27- protected $ maxRunningTime = 0 ;
28-
29- /**
30- */
31- protected function runTest ()
32- {
33- $ s = microtime (true );
34- parent ::runTest ();
35- $ time = microtime (true ) - $ s ;
36-
37- if ($ this ->maxRunningTime != 0 && $ time > $ this ->maxRunningTime ) {
38- $ this ->fail (
39- sprintf (
40- 'expected running time: <= %s but was: %s ' ,
41-
42- $ this ->maxRunningTime ,
43- $ time
44- )
45- );
46- }
47- }
48-
49- /**
50- * @param integer $maxRunningTime
51- * @throws \InvalidArgumentException
52- */
53- public function setMaxRunningTime ($ maxRunningTime )
54- {
55- if (is_integer ($ maxRunningTime ) && $ maxRunningTime >= 0 ) {
56- $ this ->maxRunningTime = $ maxRunningTime ;
57- } else {
58- throw new \InvalidArgumentException ;
59- }
60- }
61-
62- /**
63- * @return integer
64- * @since Method available since Release 2.3.0
65- */
66- public function getMaxRunningTime ()
67- {
68- return $ this ->maxRunningTime ;
69- }
7021}
You can’t perform that action at this time.
0 commit comments