Skip to content

Commit 1fa2ae7

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: Make FormPerformanceTestCase compatible with PHPUnit 10 [Security] Fix resetting traceable listeners [Validator] Add missing italian translations [Notifier] Tweak an error message Change incorrect message, when the sender in the global envelope or the from header of asEmailMessage() is not defined. Bump Symfony version to 5.4.30 Update VERSION for 5.4.29 Update CONTRIBUTORS for 5.4.29 Update CHANGELOG for 5.4.29
2 parents 0f9ad86 + eaef7a6 commit 1fa2ae7

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

Test/FormPerformanceTestCase.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Form\Test;
1313

14+
use Symfony\Component\Form\Test\Traits\RunTestTrait;
1415
use Symfony\Component\Form\Tests\VersionAwareTest;
1516

1617
/**
@@ -23,22 +24,25 @@
2324
*/
2425
abstract class FormPerformanceTestCase extends FormIntegrationTestCase
2526
{
27+
use RunTestTrait;
2628
use VersionAwareTest;
2729

2830
/**
2931
* @var int
3032
*/
3133
protected $maxRunningTime = 0;
3234

33-
protected function runTest()
35+
private function doRunTest(): mixed
3436
{
3537
$s = microtime(true);
36-
parent::runTest();
38+
$result = parent::runTest();
3739
$time = microtime(true) - $s;
3840

3941
if (0 != $this->maxRunningTime && $time > $this->maxRunningTime) {
4042
$this->fail(sprintf('expected running time: <= %s but was: %s', $this->maxRunningTime, $time));
4143
}
44+
45+
return $result;
4246
}
4347

4448
/**

Test/Traits/RunTestTrait.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
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+
}

0 commit comments

Comments
 (0)