Skip to content

Commit

Permalink
Improve deprecation layers in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ostrolucky committed Sep 4, 2023
1 parent 28fb80a commit eafb6b6
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ public function testAddCustomHydrationMode(): void
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomHydrationMode', ['test_hydrator', TestHydrator::class]);
}

/** @requires PHP 8.1 */
public function testAddFilter(): void
{
if (! interface_exists(EntityManagerInterface::class)) {
Expand Down
5 changes: 3 additions & 2 deletions Tests/DependencyInjection/Compiler/IdGeneratorPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public function testRepositoryServiceWiring(): void
'framework' => [
'http_method_override' => false,
'annotations' => [
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000,
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 60400,
],
'php_errors' => ['log' => true],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []),
] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []),
], $container);

$extension = new DoctrineExtension();
Expand All @@ -111,6 +111,7 @@ public function testRepositoryServiceWiring(): void
'orm' => [
'mappings' => $mappings,
'report_fields_where_declared' => true,
'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100,
],
],
], $container);
Expand Down
5 changes: 3 additions & 2 deletions Tests/DependencyInjection/Fixtures/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
$container->loadFromExtension('framework', [
'secret' => 'F00',
'http_method_override' => false,
'annotations' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 64000,
'annotations' => class_exists(Annotation::class) && Kernel::VERSION_ID <= 60400,
'php_errors' => ['log' => true],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []));
] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []));
$container->loadFromExtension('doctrine', [
'dbal' => [
'driver' => 'pdo_sqlite',
Expand All @@ -53,6 +53,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
'orm' => [
'report_fields_where_declared' => true,
'auto_generate_proxy_classes' => true,
'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100,
'mappings' => [
'RepositoryServiceBundle' => [
'type' => PHP_VERSION_ID >= 80000 ? 'attribute' : 'annotation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<connection name="default" dbname="db" />
</dbal>

<orm>
<orm enable-lazy-ghost-objects="true">
<filter name="soft_delete" enabled="true" >Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter</filter>
<filter name="myFilter" enabled="true" class="Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter">
<parameter name="myParameter">myValue</parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ doctrine:
dbname: db

orm:
enable_lazy_ghost_objects: true
filters:
soft_delete:
class: Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\TestFilter
Expand Down
2 changes: 1 addition & 1 deletion Tests/LockStoreSchemaListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testLockStoreSchemaSubscriberWiring(array $config, int $expected
$extension->load(
[
'framework' => ['http_method_override' => false, 'php_errors' => ['log' => true]]
+ (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []) + $config,
+ (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []) + $config,
],
$container
);
Expand Down
5 changes: 3 additions & 2 deletions Tests/ServiceRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function testRepositoryServiceWiring(): void
'http_method_override' => false,
'php_errors' => ['log' => true],
'annotations' => [
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 64000,
'enabled' => class_exists(AnnotationReader::class) && Kernel::VERSION_ID < 60400,
],
] + (Kernel::VERSION_ID >= 62000 ? ['handle_all_throwables' => true] : []),
] + (Kernel::VERSION_ID >= 60200 ? ['handle_all_throwables' => true] : []),
], $container);

$extension = new DoctrineExtension();
Expand All @@ -90,6 +90,7 @@ public function testRepositoryServiceWiring(): void
],
'orm' => [
'report_fields_where_declared' => true,
'enable_lazy_ghost_objects' => PHP_VERSION_ID >= 80100,
'mappings' => [
'RepositoryServiceBundle' => [
'type' => PHP_VERSION_ID >= 80000 ? 'attribute' : 'annotation',
Expand Down
1 change: 0 additions & 1 deletion Tests/baseline-ignore

This file was deleted.

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"symfony/string": "^5.4 || ^6.0",
"symfony/twig-bridge": "^5.4 || ^6.0",
"symfony/validator": "^5.4 || ^6.0",
"symfony/var-exporter": "^5.4 || 6.0 || ^7.0",
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
"symfony/yaml": "^5.4 || ^6.0",
"twig/twig": "^1.34 || ^2.12 || ^3.0",
Expand Down
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
</testsuite>
</testsuites>

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

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

0 comments on commit eafb6b6

Please sign in to comment.