Skip to content

Commit

Permalink
CI: Fix deprecation failures with Symfony 6.4 and ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed Sep 2, 2023
1 parent f28b1f7 commit 28fb80a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 11 deletions.
1 change: 1 addition & 0 deletions Resources/config/schema/doctrine-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<xsd:attribute name="proxy-dir" type="xsd:string" />
<xsd:attribute name="proxy-namespace" type="xsd:string" />
<xsd:attribute name="auto-generate-proxy-classes" type="xsd:string" default="false" />
<xsd:attribute name="enable-lazy-ghost-objects" type="xsd:boolean" />
<xsd:attributeGroup ref="entity-manager-config" />
</xsd:complexType>

Expand Down
8 changes: 6 additions & 2 deletions Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public function testRepositoryServiceWiring(): void
'annotations' => [
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000,
],
],
'php_errors' => ['log' => true],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []),
], $container);

$extension = new DoctrineExtension();
Expand All @@ -107,7 +108,10 @@ public function testRepositoryServiceWiring(): void
'charset' => 'UTF8',
'schema_manager_factory' => 'doctrine.dbal.default_schema_manager_factory',
],
'orm' => ['mappings' => $mappings, 'report_fields_where_declared' => true],
'orm' => [
'mappings' => $mappings,
'report_fields_where_declared' => true,
],
],
], $container);

Expand Down
8 changes: 3 additions & 5 deletions Tests/DependencyInjection/Fixtures/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
$container->loadFromExtension('framework', [
'secret' => 'F00',
'http_method_override' => false,
'annotations' => [
'enabled' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 64000,
],
]);

'annotations' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 64000,
'php_errors' => ['log' => true],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []));
$container->loadFromExtension('doctrine', [
'dbal' => [
'driver' => 'pdo_sqlite',
Expand Down
9 changes: 8 additions & 1 deletion Tests/LockStoreSchemaListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpKernel\Kernel;

use function class_exists;
use function interface_exists;
Expand Down Expand Up @@ -51,7 +52,13 @@ public function testLockStoreSchemaSubscriberWiring(array $config, int $expected

$extension = new FrameworkExtension();
$container->registerExtension($extension);
$extension->load(['framework' => ['http_method_override' => false] + $config], $container);
$extension->load(
[
'framework' => ['http_method_override' => false, 'php_errors' => ['log' => true]]
+ (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []) + $config,
],
$container
);

$extension = new DoctrineExtension();
$container->registerExtension($extension);
Expand Down
5 changes: 3 additions & 2 deletions Tests/ServiceRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public function testRepositoryServiceWiring(): void
$extension->load([
'framework' => [
'http_method_override' => false,
'php_errors' => ['log' => true],
'annotations' => [
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000,
],
],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []),
], $container);

$extension = new DoctrineExtension();
Expand All @@ -102,7 +103,7 @@ public function testRepositoryServiceWiring(): void

$def = $container->register(TestCustomServiceRepoRepository::class, TestCustomServiceRepoRepository::class)
->setPublic(false);
// create a public alias so we can use it below for testing
// create a public alias, so we can use it below for testing
$container->setAlias('test_alias__' . TestCustomServiceRepoRepository::class, new Alias(TestCustomServiceRepoRepository::class, true));

$def->setAutowired(true);
Expand Down
1 change: 1 addition & 0 deletions Tests/baseline-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3%
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"doctrine/annotations": "^1 || ^2",
"doctrine/coding-standard": "^9.0",
"doctrine/deprecations": "^1.0",
"doctrine/orm": "^2.11 || ^3.0",
"doctrine/orm": "^2.14 || ^3.0",
"friendsofphp/proxy-manager-lts": "^1.0",
"phpunit/phpunit": "^9.5.26 || ^10.0",
"psalm/plugin-phpunit": "^0.18.4",
Expand All @@ -57,6 +57,7 @@
"symfony/property-info": "^5.4 || ^6.0",
"symfony/proxy-manager-bridge": "^5.4 || ^6.0",
"symfony/security-bundle": "^5.4 || ^6.0",
"symfony/string": "^5.4 || ^6.0",
"symfony/twig-bridge": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
Expand Down Expand Up @@ -92,5 +93,11 @@
"symfony/flex": true
},
"sort-packages": true
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
</testsuite>
</testsuites>

<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=./Tests/baseline-ignore"/>
</php>

<filter>
<whitelist>
<directory>.</directory>
Expand Down

0 comments on commit 28fb80a

Please sign in to comment.