Skip to content

Commit f960d64

Browse files
Merge branch '6.4' into 7.2
* 6.4: [Validator] review cs tran Fix building packages in the CI implicitly run all Composer commands non-interactively [FrameworkBundle] ensureKernelShutdown in tearDownAfterClass
2 parents 47f3667 + ec76ab4 commit f960d64

File tree

6 files changed

+28
-38
lines changed

6 files changed

+28
-38
lines changed

.github/build-packages.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
<?php
22

3-
require __DIR__.'/vendor/autoload.php';
4-
5-
use Composer\MetadataMinifier\MetadataMinifier;
3+
// Logic inspired from composer/metadata-minifier
4+
function expandComposerMetadata(array $versions): array
5+
{
6+
array_reduce($versions, function ($carry, $version) use (&$expandedVersions) {
7+
return $expandedVersions[] = array_filter(array_merge($carry, $version), fn ($v) => '__unset' !== $v);
8+
}, []);
9+
10+
return $expandedVersions ?? [];
11+
}
612

713
if (3 > $_SERVER['argc']) {
814
echo "Usage: branch version dir1 dir2 ... dirN\n";
@@ -56,24 +62,14 @@
5662

5763
$packages[$package->name][$package->version] = $package;
5864

59-
if (false !== $taggedReleases = @file_get_contents('https://repo.packagist.org/p2/'.$package->name.'.json')) {
60-
$versions = MetadataMinifier::expand(json_decode($taggedReleases, true)['packages'][$package->name]);
65+
foreach (['.json', '~dev.json'] as $ext) {
66+
$versions = @file_get_contents('https://repo.packagist.org/p2/'.$package->name.$ext) ?: '[]';
67+
$versions = json_decode($versions, true)['packages'][$package->name] ?? [];
6168

62-
foreach ($versions as $v => $p) {
63-
$packages[$package->name] += [$v => $p];
69+
foreach (expandComposerMetadata($versions) as $p) {
70+
$packages[$package->name] += [$p['version'] => $p];
6471
}
6572
}
66-
67-
if (false !== $devReleases = @file_get_contents('https://repo.packagist.org/p2/'.$package->name.'~dev.json')) {
68-
$versions = MetadataMinifier::expand(json_decode($taggedReleases, true)['packages'][$package->name]);
69-
} else {
70-
$versions = sprintf('{"packages":{"%s":{"%s":%s}}}', $package->name, $package->version, file_get_contents($dir.'/composer.json'));
71-
$versions = json_decode($versions, true)['packages'][$package->name];
72-
}
73-
74-
foreach ($versions as $v => $p) {
75-
$packages[$package->name] += [$v => $p];
76-
}
7773
}
7874

7975
file_put_contents('packages.json', json_encode(compact('packages'), $flags));

.github/composer.json

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

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,12 @@ jobs:
9292
9393
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
9494
if [[ ! "${{ matrix.mode }}" = *-deps ]]; then
95-
cd .github
96-
composer install
97-
php ./build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
98-
cd ..
95+
php .github/build-packages.php HEAD^ $SYMFONY_VERSION src/Symfony/Bridge/PhpUnit
9996
else
10097
echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV
10198
cp composer.json composer.json.orig
10299
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json
103-
cd .github
104-
composer install
105-
php ./build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin)
106-
cd ..
100+
php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Emoji/Resources/bin)
107101
mv composer.json composer.json.phpunit
108102
mv composer.json.orig composer.json
109103
fi

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
'COMPOSER' => 'composer.json',
139139
'COMPOSER_VENDOR_DIR' => 'vendor',
140140
'COMPOSER_BIN_DIR' => 'bin',
141+
'COMPOSER_NO_INTERACTION' => '1',
141142
'SYMFONY_SIMPLE_PHPUNIT_BIN_DIR' => __DIR__,
142143
];
143144

@@ -234,13 +235,13 @@
234235
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
235236
chdir("$PHPUNIT_VERSION_DIR");
236237
if ($SYMFONY_PHPUNIT_REMOVE) {
237-
$passthruOrFail("$COMPOSER remove --no-update --no-interaction ".$SYMFONY_PHPUNIT_REMOVE);
238+
$passthruOrFail("$COMPOSER remove --no-update ".$SYMFONY_PHPUNIT_REMOVE);
238239
}
239240
if ($SYMFONY_PHPUNIT_REQUIRE) {
240-
$passthruOrFail("$COMPOSER require --no-update --no-interaction ".$SYMFONY_PHPUNIT_REQUIRE);
241+
$passthruOrFail("$COMPOSER require --no-update ".$SYMFONY_PHPUNIT_REQUIRE);
241242
}
242243
if (5.1 <= $PHPUNIT_VERSION && $PHPUNIT_VERSION < 5.4) {
243-
$passthruOrFail("$COMPOSER require --no-update --no-interaction phpunit/phpunit-mock-objects \"~3.1.0\"");
244+
$passthruOrFail("$COMPOSER require --no-update phpunit/phpunit-mock-objects \"~3.1.0\"");
244245
}
245246

246247
if (preg_match('{\^((\d++\.)\d++)[\d\.]*$}', $info['requires']['php'], $phpVersion) && version_compare($phpVersion[2].'99', \PHP_VERSION, '<')) {
@@ -256,13 +257,13 @@
256257
if (realpath($p) === realpath($path)) {
257258
$path = $p;
258259
}
259-
$passthruOrFail("$COMPOSER require --no-update --no-interaction symfony/phpunit-bridge \"*@dev\"");
260+
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*@dev\"");
260261
$passthruOrFail("$COMPOSER config repositories.phpunit-bridge path ".escapeshellarg(str_replace('/', \DIRECTORY_SEPARATOR, $path)));
261262
if ('\\' === \DIRECTORY_SEPARATOR) {
262263
file_put_contents('composer.json', preg_replace('/^( {8})"phpunit-bridge": \{$/m', "$0\n$1 ".'"options": {"symlink": false},', file_get_contents('composer.json')));
263264
}
264265
} else {
265-
$passthruOrFail("$COMPOSER require --no-update --no-interaction symfony/phpunit-bridge \"*\"");
266+
$passthruOrFail("$COMPOSER require --no-update symfony/phpunit-bridge \"*\"");
266267
}
267268
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
268269
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Test;
1313

14+
use PHPUnit\Framework\Attributes\AfterClass;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\DependencyInjection\Container;
1617
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
@@ -112,8 +113,11 @@ protected static function createKernel(array $options = []): KernelInterface
112113

113114
/**
114115
* Shuts the kernel down if it was used in the test - called by the tearDown method by default.
116+
*
117+
* @afterClass
115118
*/
116-
protected static function ensureKernelShutdown()
119+
#[AfterClass]
120+
public static function ensureKernelShutdown()
117121
{
118122
if (null !== static::$kernel) {
119123
static::$kernel->boot();

src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@
468468
</trans-unit>
469469
<trans-unit id="121">
470470
<source>This value is not a valid Twig template.</source>
471-
<target state="needs-review-translation">Tato hodnota není platná šablona Twig.</target>
471+
<target>Tato hodnota není platná Twig šablona.</target>
472472
</trans-unit>
473473
</body>
474474
</file>

0 commit comments

Comments
 (0)