aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/form/Symfony/Component/Form/Test
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
commit4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch)
tree6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/form/Symfony/Component/Form/Test
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Test')
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php42
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php41
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php70
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php41
6 files changed, 226 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php b/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php
new file mode 100644
index 00000000..36417f74
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php
@@ -0,0 +1,42 @@
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\Test;
13
14use Symfony\Component\Form\FormEvent;
15
16class DeprecationErrorHandler
17{
18 public static function handle($errorNumber, $message, $file, $line, $context)
19 {
20 if ($errorNumber & E_USER_DEPRECATED) {
21 return true;
22 }
23
24 return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line);
25 }
26
27 public static function handleBC($errorNumber, $message, $file, $line, $context)
28 {
29 if ($errorNumber & E_USER_DEPRECATED) {
30 return true;
31 }
32
33 return false;
34 }
35
36 public static function preBind($listener, FormEvent $event)
37 {
38 set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
39 $listener->preBind($event);
40 restore_error_handler();
41 }
42}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php
new file mode 100644
index 00000000..711cecd0
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php
@@ -0,0 +1,16 @@
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\Test;
13
14interface FormBuilderInterface extends \Iterator, \Symfony\Component\Form\FormBuilderInterface
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php
new file mode 100644
index 00000000..68e5f244
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php
@@ -0,0 +1,41 @@
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\Test;
13
14use Symfony\Component\Form\Forms;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract 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}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php
new file mode 100644
index 00000000..22a83fd7
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php
@@ -0,0 +1,16 @@
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\Test;
13
14interface FormInterface extends \Iterator, \Symfony\Component\Form\FormInterface
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php
new file mode 100644
index 00000000..573f4e91
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php
@@ -0,0 +1,70 @@
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\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 */
22abstract 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}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php
new file mode 100644
index 00000000..9d51a9ee
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php
@@ -0,0 +1,41 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.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\Test;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\EventDispatcher\EventDispatcher;
16
17abstract class TypeTestCase extends FormIntegrationTestCase
18{
19 /**
20 * @var FormBuilder
21 */
22 protected $builder;
23
24 /**
25 * @var EventDispatcher
26 */
27 protected $dispatcher;
28
29 protected function setUp()
30 {
31 parent::setUp();
32
33 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
34 $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
35 }
36
37 public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual)
38 {
39 self::assertEquals($expected->format('c'), $actual->format('c'));
40 }
41}