File tree Expand file tree Collapse file tree 2 files changed +43
-3
lines changed
src/Symfony/Component/Form/Test Expand file tree Collapse file tree 2 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \Form \Test ;
13
13
14
+ use Symfony \Component \Form \Test \Traits \RunTestTrait ;
14
15
use Symfony \Component \Form \Tests \VersionAwareTest ;
15
16
16
17
/**
23
24
*/
24
25
abstract class FormPerformanceTestCase extends FormIntegrationTestCase
25
26
{
27
+ use RunTestTrait;
26
28
use VersionAwareTest;
27
29
28
30
/**
@@ -31,17 +33,19 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
31
33
protected $ maxRunningTime = 0 ;
32
34
33
35
/**
34
- * {@inheritdoc}
36
+ * @return mixed
35
37
*/
36
- protected function runTest ()
38
+ private function doRunTest ()
37
39
{
38
40
$ s = microtime (true );
39
- parent ::runTest ();
41
+ $ result = parent ::runTest ();
40
42
$ time = microtime (true ) - $ s ;
41
43
42
44
if (0 != $ this ->maxRunningTime && $ time > $ this ->maxRunningTime ) {
43
45
$ this ->fail (sprintf ('expected running time: <= %s but was: %s ' , $ this ->maxRunningTime , $ time ));
44
46
}
47
+
48
+ return $ result ;
45
49
}
46
50
47
51
/**
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 \Traits ;
13
+
14
+ use PHPUnit \Framework \TestCase ;
15
+
16
+ if ((new \ReflectionMethod (TestCase::class, 'runTest ' ))->hasReturnType ()) {
17
+ // PHPUnit 10
18
+ /** @internal */
19
+ trait RunTestTrait
20
+ {
21
+ protected function runTest (): mixed
22
+ {
23
+ return $ this ->doRunTest ();
24
+ }
25
+ }
26
+ } else {
27
+ // PHPUnit 9
28
+ /** @internal */
29
+ trait RunTestTrait
30
+ {
31
+ protected function runTest ()
32
+ {
33
+ return $ this ->doRunTest ();
34
+ }
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments