|
11 | 11 |
|
12 | 12 | namespace Symfony\UX\LiveComponent\Tests\Integration\Hydration;
|
13 | 13 |
|
14 |
| -use Doctrine\ORM\EntityManager; |
| 14 | + |
15 | 15 | use Doctrine\ORM\EntityManagerInterface;
|
16 |
| -use Doctrine\ORM\Tools\ResolveTargetEntityListener; |
17 | 16 | use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
18 |
| -use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
19 |
| -use Symfony\Contracts\Service\Attribute\Required; |
20 | 17 | use Symfony\UX\LiveComponent\Hydration\DoctrineEntityHydrationExtension;
|
21 | 18 | use Symfony\UX\LiveComponent\Tests\Fixtures\Entity\AliasedEntity;
|
22 | 19 | use Symfony\UX\LiveComponent\Tests\Fixtures\Entity\AliasedEntityInterface;
|
@@ -75,19 +72,17 @@ public function testHydrationFromInterface(): void
|
75 | 72 | $extension = self::getContainer()->get('ux.live_component.doctrine_entity_hydration_extension');
|
76 | 73 | $em = self::getContainer()->get(EntityManagerInterface::class);
|
77 | 74 |
|
78 |
| - $a = new AliasedEntity(); |
79 |
| - $a->name = 'foo'; |
| 75 | + $existingEntity = new AliasedEntity(); |
| 76 | + $existingEntity->name = 'foo'; |
80 | 77 |
|
81 |
| - $em->persist($a); |
| 78 | + $em->persist($existingEntity); |
82 | 79 | $em->flush();
|
83 | 80 |
|
84 |
| - $dehydratedData = $extension->dehydrate($a); |
| 81 | + $dehydratedData = $extension->dehydrate($existingEntity); |
85 | 82 |
|
86 |
| - $a2 = $extension->hydrate($dehydratedData, AliasedEntityInterface::class); |
| 83 | + $entityFromDehydratation = $extension->hydrate($dehydratedData, AliasedEntityInterface::class); |
87 | 84 |
|
88 |
| - self::assertSame($a, $a2,"instance should be the same"); |
| 85 | + self::assertSame($existingEntity, $entityFromDehydratation,"instance should be the same"); |
89 | 86 | self::assertNull($extension->hydrate(null, AliasedEntityInterface::class),"should return null if null is passed");
|
90 |
| - |
91 |
| - |
92 | 87 | }
|
93 | 88 | }
|
0 commit comments