Skip to content

Commit

Permalink
bug #1371 fix: use concrete class (instead of anon) for test (kbond)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

fix: use concrete class (instead of anon) for test

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Issues        | #1369
| License       | MIT

`symfony/property-accessor` doesn't appear to parse object types from anon class props when imported. This is a quick fix to get the CI passing.

Commits
-------

e9046f2 fix: use concrete class (instead of anon) for test
  • Loading branch information
kbond committed Jan 2, 2024
2 parents 95e5be8 + e9046f2 commit 41a53d5
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,7 @@ public function onEntireEntityUpdated($oldValue)
$prod2 = new ProductFixtureEntity();
$prod3 = create(ProductFixtureEntity::class, ['name' => 'item3'])->object();

return HydrationTest::create(new class() {
#[LiveProp()]
/** @var \Symfony\UX\LiveComponent\Tests\Fixtures\Entity\ProductFixtureEntity[] */
public array $products = [];
})
return HydrationTest::create(new DummyObjectWithObjects())
->mountWith(['products' => [$prod1, $prod2, $prod3]])
->assertDehydratesTo([
'products' => [$prod1->id, [], $prod3->id],
Expand Down Expand Up @@ -1643,3 +1639,10 @@ public function __construct(
) {
}
}

class DummyObjectWithObjects
{
#[LiveProp()]
/** @var ProductFixtureEntity[] */
public array $products = [];
}

0 comments on commit 41a53d5

Please sign in to comment.