Skip to content

Commit

Permalink
[LiveComponent] Fix test Kernel deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre committed Jan 1, 2024
1 parent d109f66 commit 203f5e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
22 changes: 19 additions & 3 deletions src/LiveComponent/tests/Fixtures/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\UX\LiveComponent\Tests\Fixtures;

use Composer\InstalledVersions;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Psr\Log\NullLogger;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
Expand Down Expand Up @@ -125,8 +126,10 @@ protected function configureContainer(ContainerConfigurator $c): void
'auto_refresh_proxies' => false,
]);

$c->extension('doctrine', [
'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'],
$doctrineConfig = [
'dbal' => [
'url' => '%env(resolve:DATABASE_URL)%',
],
'orm' => [
'auto_generate_proxy_classes' => true,
'auto_mapping' => true,
Expand All @@ -147,7 +150,20 @@ protected function configureContainer(ContainerConfigurator $c): void
],
],
],
]);
];
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
}
// https://github.com/doctrine/DoctrineBundle/pull/1661
if (version_compare($doctrineBundleVersion, '2.9.0', '>=')) {
$doctrineConfig['orm']['report_fields_where_declared'] = true;
$doctrineConfig['orm']['validate_xml_mapping'] = true;
$doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory';
}
}

$c->extension('doctrine', $doctrineConfig);

$c->extension('zenstruck_foundry', [
'auto_refresh_proxies' => false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ public function onEntireEntityUpdated($oldValue)
'invoice.lineItems.2' => ['name' => 'item3_updated', 'quantity' => 2, 'price' => 2000],
])
->assertObjectAfterHydration(function (object $object) {
self::assertSame([
self::assertSame(
[
'number' => '456',
'lineItems' => [
['name' => 'item1', 'quantity' => 5, 'price' => 100],
Expand Down Expand Up @@ -752,7 +753,7 @@ public function onEntireEntityUpdated($oldValue)
return HydrationTest::create(new class() {
#[LiveProp()]
/** @var \Symfony\UX\LiveComponent\Tests\Fixtures\Entity\ProductFixtureEntity[] */
public $products = [];
public array $products = [];
})
->mountWith(['products' => [$prod1, $prod2, $prod3]])
->assertDehydratesTo([
Expand Down

0 comments on commit 203f5e1

Please sign in to comment.