Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LiveComponent] Fix test Kernel deprecations #1369

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

smnandre
Copy link
Member

@smnandre smnandre commented Jan 1, 2024

Fix some Kernel deprecation.

But the CS remains, because (and it's kinda weird) PhpCSFixer says

 --- /home/runner/work/ux/ux/src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php
+++ /home/runner/work/ux/ux/src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php
@@ -752,7 +752,7 @@
 
             return HydrationTest::create(new class() {
                 #[LiveProp()]
-                /** @var \Symfony\UX\LiveComponent\Tests\Fixtures\Entity\ProductFixtureEntity[] */
+                /** @var ProductFixtureEntity[] */
                 public array $products = [];
             })
                 ->mountWith(['products' => [$prod1, $prod2, $prod3]])

But if we do that ....

1) Symfony\UX\LiveComponent\Tests\Integration\LiveComponentHydratorTest::testCanDehydrateAndHydrateComponentWithTestCases with data set "Array with objects: (de)hydrates correctly" (Closure Object (...))
LogicException: The LiveProp "products" on component "class@anonymous[...]src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php:753$4c" is an array. We determined the array is full of \ProductFixtureEntity objects, but at least on key had a different value of Symfony\UX\LiveComponent\Tests\Fixtures\Entity\ProductFixtureEntity

@smnandre smnandre force-pushed the fix/live-component-deprecations branch from a165725 to 203f5e1 Compare January 1, 2024 14:24
@smnandre
Copy link
Member Author

smnandre commented Jan 1, 2024

Any idea @kbond @weaverryan ?

@smnandre
Copy link
Member Author

smnandre commented Jan 1, 2024

(we should merge this one "now" if we need time to figure out the phpcs bug, as this PR fixes the other CI fails)

@kbond
Copy link
Member

kbond commented Jan 2, 2024

Thanks Simon.

@kbond kbond merged commit 9c0efe4 into symfony:2.x Jan 2, 2024
33 of 34 checks passed
@kbond
Copy link
Member

kbond commented Jan 2, 2024

Regarding the cs issue - looks the anon class must be the culprit. Bug in symfony/property-access maybe?

@smnandre
Copy link
Member Author

smnandre commented Jan 2, 2024

Regarding the cs issue - looks the anon class must be the culprit. Bug in symfony/property-access maybe?

Hmm I feared that answer haha… well, time to discover the internals of a new component :)

@kbond
Copy link
Member

kbond commented Jan 2, 2024

I think the easy fix for now would be to use a concrete class instead of anon in this test.

@smnandre
Copy link
Member Author

smnandre commented Jan 2, 2024

Ok, will do tonight

@kbond
Copy link
Member

kbond commented Jan 2, 2024

Fixed in #1371

kbond added a commit that referenced this pull request Jan 2, 2024
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
@smnandre
Copy link
Member Author

smnandre commented Jan 2, 2024

Thank you @kbond !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants