Skip to content

Commit 8eef5f1

Browse files
bug symfony#61731 [PhpUnitBridge] Fix gathering deprecation in phpt (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [PhpUnitBridge] Fix gathering deprecation in phpt | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 8e35b50 [PhpUnitBridge] Fix gathering deprecation in phpt
2 parents 85b7f4a + 8e35b50 commit 8eef5f1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use PHPUnit\Framework\TestCase;
1919
use PHPUnit\Framework\TestSuite;
2020
use PHPUnit\Runner\BaseTestRunner;
21+
use PHPUnit\Runner\PhptTestCase;
2122
use PHPUnit\Util\Blacklist;
2223
use PHPUnit\Util\ExcludeList;
2324
use PHPUnit\Util\Test;
@@ -206,6 +207,12 @@ public function addSkippedTest($test, \Exception $e, $time): void
206207

207208
public function startTest($test): void
208209
{
210+
if (-2 < $this->state && $test instanceof PhptTestCase) {
211+
$this->runsInSeparateProcess = tempnam(sys_get_temp_dir(), 'deprec');
212+
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$this->runsInSeparateProcess);
213+
putenv('SYMFONY_EXPECTED_DEPRECATIONS_SERIALIZE='.tempnam(sys_get_temp_dir(), 'expectdeprec'));
214+
}
215+
209216
if (-2 < $this->state && $test instanceof TestCase) {
210217
// This event is triggered before the test is re-run in isolation
211218
if ($this->willBeIsolated($test)) {

src/Symfony/Component/String/Tests/LazyStringTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\String\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\ErrorHandler\ErrorHandler;
1615
use Symfony\Component\String\LazyString;
1716

1817
class LazyStringTest extends TestCase
@@ -34,8 +33,6 @@ public function testLazyString()
3433
*/
3534
public function testReturnTypeError()
3635
{
37-
ErrorHandler::register();
38-
3936
$s = LazyString::fromCallable(fn () => []);
4037

4138
$this->expectException(\TypeError::class);

src/Symfony/Component/String/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
"symfony/polyfill-mbstring": "~1.0"
2424
},
2525
"require-dev": {
26-
"symfony/error-handler": "^5.4|^6.0|^7.0",
27-
"symfony/intl": "^6.2|^7.0",
2826
"symfony/http-client": "^5.4|^6.0|^7.0",
27+
"symfony/intl": "^6.2|^7.0",
2928
"symfony/translation-contracts": "^2.5|^3.0",
3029
"symfony/var-exporter": "^5.4|^6.0|^7.0"
3130
},

0 commit comments

Comments
 (0)