Skip to content

Commit 203f5e1

Browse files
committed
[LiveComponent] Fix test Kernel deprecations
1 parent d109f66 commit 203f5e1

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/LiveComponent/tests/Fixtures/Kernel.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\LiveComponent\Tests\Fixtures;
1313

14+
use Composer\InstalledVersions;
1415
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
1516
use Psr\Log\NullLogger;
1617
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
@@ -125,8 +126,10 @@ protected function configureContainer(ContainerConfigurator $c): void
125126
'auto_refresh_proxies' => false,
126127
]);
127128

128-
$c->extension('doctrine', [
129-
'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'],
129+
$doctrineConfig = [
130+
'dbal' => [
131+
'url' => '%env(resolve:DATABASE_URL)%',
132+
],
130133
'orm' => [
131134
'auto_generate_proxy_classes' => true,
132135
'auto_mapping' => true,
@@ -147,7 +150,20 @@ protected function configureContainer(ContainerConfigurator $c): void
147150
],
148151
],
149152
],
150-
]);
153+
];
154+
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
155+
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
156+
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
157+
}
158+
// https://github.com/doctrine/DoctrineBundle/pull/1661
159+
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
160+
$doctrineConfig['orm']['report_fields_where_declared'] = true;
161+
$doctrineConfig['orm']['validate_xml_mapping'] = true;
162+
$doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory';
163+
}
164+
}
165+
166+
$c->extension('doctrine', $doctrineConfig);
151167

152168
$c->extension('zenstruck_foundry', [
153169
'auto_refresh_proxies' => false,

src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ public function onEntireEntityUpdated($oldValue)
609609
'invoice.lineItems.2' => ['name' => 'item3_updated', 'quantity' => 2, 'price' => 2000],
610610
])
611611
->assertObjectAfterHydration(function (object $object) {
612-
self::assertSame([
612+
self::assertSame(
613+
[
613614
'number' => '456',
614615
'lineItems' => [
615616
['name' => 'item1', 'quantity' => 5, 'price' => 100],
@@ -752,7 +753,7 @@ public function onEntireEntityUpdated($oldValue)
752753
return HydrationTest::create(new class() {
753754
#[LiveProp()]
754755
/** @var \Symfony\UX\LiveComponent\Tests\Fixtures\Entity\ProductFixtureEntity[] */
755-
public $products = [];
756+
public array $products = [];
756757
})
757758
->mountWith(['products' => [$prod1, $prod2, $prod3]])
758759
->assertDehydratesTo([

0 commit comments

Comments
 (0)