diff options
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php deleted file mode 100644 index 573f4e91..00000000 --- a/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
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 | } | ||