Skip to content

Commit be8086b

Browse files
committed
chore: test Symfony 8
1 parent 11355a9 commit be8086b

25 files changed

+387
-83
lines changed

bin/tools/phpstan/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"phpstan/phpstan-symfony": "^2.0",
66
"phpstan/extension-installer": "^1.2",
77
"phpstan/phpstan-doctrine": "^2.0",
8-
"phpstan/phpstan-phpunit": "^2.0"
8+
"phpstan/phpstan-phpunit": "^2.0",
9+
"symfony/var-exporter": "^7"
910
},
1011
"config": {
1112
"allow-plugins": {

bin/tools/phpstan/composer.lock

Lines changed: 161 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,33 @@
2020
"fakerphp/faker": "^1.23",
2121
"symfony/deprecation-contracts": "^2.2|^3.0",
2222
"symfony/polyfill-php84": "^1.32",
23-
"symfony/property-access": "^6.4|^7.0|^8.0",
24-
"symfony/property-info": "^6.4|^7.0|^8.0",
23+
"symfony/property-access": "^8.0",
24+
"symfony/property-info": "^8.0",
2525
"symfony/var-exporter": "^6.4.9|~7.0.9|^7.1.2|^8.0",
2626
"zenstruck/assert": "^1.4"
2727
},
2828
"require-dev": {
2929
"bamarni/composer-bin-plugin": "^1.8",
30-
"brianium/paratest": "^6|^7",
3130
"dama/doctrine-test-bundle": "^8.0",
3231
"doctrine/collections": "^1.7|^2.0",
3332
"doctrine/common": "^3.2.2",
34-
"doctrine/doctrine-bundle": "^2.10",
35-
"doctrine/doctrine-migrations-bundle": "^2.2|^3.0",
36-
"doctrine/mongodb-odm": "^2.4",
37-
"doctrine/mongodb-odm-bundle": "^4.6|^5.0",
38-
"doctrine/orm": "^2.16|^3.0",
33+
"doctrine/doctrine-bundle": "3.1.x-dev",
34+
"doctrine/mongodb-odm": "2.15.x-dev",
35+
"doctrine/mongodb-odm-bundle": "5.5.x-dev",
36+
"doctrine/orm": "3.5.x-dev",
3937
"doctrine/persistence": "^2.0|^3.0|^4.0",
4038
"phpunit/phpunit": "^9.5.0 || ^10.0 || ^11.0 || ^12.0",
41-
"symfony/browser-kit": "^6.4|^7.0|^8.0",
42-
"symfony/console": "^6.4|^7.0|^8.0",
43-
"symfony/dotenv": "^6.4|^7.0|^8.0",
44-
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
45-
"symfony/maker-bundle": "^1.55",
46-
"symfony/phpunit-bridge": "^6.4|^7.0|^8.0",
47-
"symfony/routing": "^6.4|^7.0|^8.0",
48-
"symfony/runtime": "^6.4|^7.0|^8.0",
39+
"symfony/browser-kit": "^8.0",
40+
"symfony/console": "^8.0",
41+
"symfony/dotenv": "^8.0",
42+
"symfony/framework-bundle": "^8.0",
43+
"symfony/phpunit-bridge": "^8.0",
44+
"symfony/routing": "^8.0",
45+
"symfony/runtime": "^8.0",
4946
"symfony/translation-contracts": "^3.4",
50-
"symfony/uid": "^6.4|^7.0|^8.0",
51-
"symfony/var-dumper": "^6.4|^7.0|^8.0",
52-
"symfony/yaml": "^6.4|^7.0|^8.0",
47+
"symfony/uid": "^8.0",
48+
"symfony/var-dumper": "^8.0",
49+
"symfony/yaml": "^8.0",
5350
"webmozart/assert": "^1.11"
5451
},
5552
"autoload": {
@@ -99,6 +96,6 @@
9996
"scripts": {
10097
"post-install-cmd": ["@composer bin phpstan install", "@composer bin phpbench install"]
10198
},
102-
"minimum-stability": "dev",
99+
"minimum-stability": "beta",
103100
"prefer-stable": true
104101
}

phpunit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ check_phpunit_version() {
1717
fi
1818
}
1919

20+
can_use_legacy_proxies() {
21+
INSTALLED_SYMFONY_VERSION=$(${COMPOSER_BIN} info symfony/var-exporter | grep versions | cut -c 15-)
22+
23+
if [[ "${INSTALLED_SYMFONY_VERSION}" == "8"* ]]; then
24+
echo 0;
25+
else
26+
echo 1;
27+
fi
28+
}
29+
2030
### >> load env vars from .env files if not in CI and not from a composer script
2131
if [ -z "${CI:-}" ] ; then
2232
source .env
@@ -74,6 +84,10 @@ case ${PHPUNIT_VERSION} in
7484
if [ "${USE_FOUNDRY_PHPUNIT_EXTENSION:-0}" = "1" ]; then
7585
PHPUNIT_EXEC="${PHPUNIT_EXEC} --extension "${FOUNDRY_EXTENSION}""
7686
fi
87+
88+
if [ "$(can_use_legacy_proxies)" = "0" ]; then
89+
PHPUNIT_EXEC="${PHPUNIT_EXEC} --exclude-group legacy-proxy"
90+
fi
7791
;;
7892
esac
7993

phpunit-deprecation-baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Foundry now leverages the native PHP lazy system to auto-refresh objects (it can
1414
See https://github.com/zenstruck/foundry/blob/2.x/UPGRADE-2.7.md to upgrade.]]></issue>
1515

1616
<issue><![CDATA[Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:75 called by AbstractDriverMiddleware.php:32, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)]]></issue>
17+
<issue><![CDATA[Since doctrine/doctrine-bundle 3.1: The "auto_mapping" option is deprecated and will be removed in DoctrineBundle 4.0, as it only accepts `false` since 3.0.]]></issue>
1718
</line>
1819
</file>
1920
<file path="vendor/doctrine/deprecations/src/Deprecation.php">

tests/Fixture/Entity/Contact.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ class Contact extends Base
3535

3636
/** @var Collection<int,Tag> */
3737
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'contacts')]
38-
#[ORM\JoinColumn(nullable: false)]
39-
#[ORM\InverseJoinColumn(nullable: false)]
4038
protected Collection $tags;
4139

4240
/** @var Collection<int,Tag> */
4341
#[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'secondaryContacts')]
4442
#[ORM\JoinTable(name: 'category_tag_standard_secondary')]
45-
#[ORM\JoinColumn(nullable: false)]
46-
#[ORM\InverseJoinColumn(nullable: false)]
4743
protected Collection $secondaryTags;
4844

4945
#[ORM\OneToOne(targetEntity: Address::class, inversedBy: 'contact')]

tests/Fixture/FoundryTestKernel.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ public static function usePHP84LazyObjects(): bool
7575
return \PHP_VERSION_ID >= 80400 && \getenv('USE_PHP_84_LAZY_OBJECTS');
7676
}
7777

78+
public static function canUseLegacyProxy(): bool
79+
{
80+
return !\str_starts_with(self::VERSION, '8');
81+
}
82+
7883
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void
7984
{
8085
$frameworkConfiguration = [
@@ -98,7 +103,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
98103
$c->loadFromExtension('framework', $frameworkConfiguration);
99104

100105
if (self::hasORM()) {
101-
$c->loadFromExtension('doctrine', [
106+
$doctrineConfig = [
102107
'dbal' => ['url' => '%env(resolve:DATABASE_URL)%', 'use_savepoints' => true],
103108
'orm' => [
104109
'auto_generate_proxy_classes' => true,
@@ -136,12 +141,22 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
136141
],
137142
'controller_resolver' => ['auto_mapping' => false],
138143
],
139-
]);
144+
];
140145

141-
if (\PHP_VERSION_ID >= 80400) {
146+
if (file_exists(__DIR__.'/../../vendor/doctrine/doctrine-bundle/UPGRADE-3.0.md')) {
147+
unset($doctrineConfig['dbal']['use_savepoints']);
148+
unset($doctrineConfig['orm']['auto_generate_proxy_classes']);
149+
}
150+
151+
if (file_exists(__DIR__.'/../../vendor/doctrine/doctrine-bundle/UPGRADE-3.1.md')) {
152+
unset($doctrineConfig['orm']['auto_mapping']);
153+
unset($doctrineConfig['controller_resolver']['auto_mapping']);
154+
} elseif (\PHP_VERSION_ID >= 80400) {
142155
$c->loadFromExtension('doctrine', ['orm' => ['enable_native_lazy_objects' => true]]);
143156
}
144157

158+
$c->loadFromExtension('doctrine', $doctrineConfig);
159+
145160
$c->register(ChangeCascadePersistOnLoadClassMetadataListener::class)
146161
->setAutowired(true)
147162
->setAutoconfigured(true);

0 commit comments

Comments
 (0)