Skip to content

Commit cc52e50

Browse files
minor symfony#61472 [PhpUnitBridge] Code cleanup (nicolas-grekas)
This PR was merged into the 7.4 branch. Discussion ---------- [PhpUnitBridge] Code cleanup | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 594a5c8 [PhpUnitBridge] Code cleanup
2 parents af4323e + 594a5c8 commit cc52e50

File tree

3 files changed

+4
-121
lines changed

3 files changed

+4
-121
lines changed

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
256256
- name: Run PhpUnitBridge tests with PHPUnit 9.6
257257
if: '! matrix.mode'
258-
run: |
259-
./phpunit src/Symfony/Bridge/PhpUnit
260258
env:
261259
SYMFONY_PHPUNIT_VERSION: '9.6'
260+
run: |
261+
./phpunit src/Symfony/Bridge/PhpUnit

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

Lines changed: 0 additions & 116 deletions
This file was deleted.

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@
270270
exit($exit);
271271
}
272272

273-
$alteredCode = file_get_contents($alteredFile = './src/Runner/PhptTestCase.php');
273+
// Mutate PhptTestCase code
274+
$alteredCode = file_get_contents($alteredFile = is_file('./src/Runner/PHPT/PhptTestCase.php') ? './src/Runner/PHPT/PhptTestCase.php' : './src/Runner/PhptTestCase.php');
274275
if (str_contains($alteredCode, " 'report_memleaks=0',\n")) {
275276
$alteredCode = str_replace(" 'report_memleaks=0',\n", '', $alteredCode);
276277
file_put_contents($alteredFile, $alteredCode);
@@ -282,8 +283,6 @@
282283
if ($PHPUNIT_REMOVE_RETURN_TYPEHINT) {
283284
$alteredCode = preg_replace('/^ ((?:protected|public)(?: static)? function \w+\(\)): void/m', ' $1', $alteredCode);
284285
}
285-
$alteredCode = preg_replace('/abstract class TestCase[^\{]+\{/', '$0 '.\PHP_EOL." use \Symfony\Bridge\PhpUnit\Legacy\PolyfillTestCaseTrait;", $alteredCode, 1);
286-
file_put_contents($alteredFile, $alteredCode);
287286

288287
// Mutate Assert code
289288
$alteredCode = file_get_contents($alteredFile = './src/Framework/Assert.php');

0 commit comments

Comments
 (0)