-
-
Notifications
You must be signed in to change notification settings - Fork 331
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
fix(): Fix the missing resolving or references in simple string arrays #984
fix(): Fix the missing resolving or references in simple string arrays #984
Conversation
Thanks very much for the fix! Could you add a test as well to LoaderIntegrationTest? Your patch should be enough strictly speaking but I prefer to add an extra safety with an integration test |
@theofidry isn't this the test already? https://github.com/nelmio/alice/blob/master/tests/Loader/LoaderIntegrationTest.php#L2546 It looks like exactly what I need. Just asking myself why this test passes in the current master. 🤔 |
Ah indeed, then could it be that the reproducer is not just having a plain array? Do you have a unique property or something with it? |
this is a plain array isn't it? Or maybe I don't get exactly what you mean by "plain array"... |
Yes it is. There is several reports (like #973) which hints there is an issue with some values which are not properly resolved, so I don't doubt you encountered that situation. I just think the failing scenario is not the one you original described. But maybe the other linked issue can give an idea of what can cause this failure, and once found, we can add a test to |
@theofidry yes, issue #973 was exactly the problem I solved with this PR now. So #973 will also be fixed once this gets merged. It must be something different as the test I mentioned passes in master without problems. Although I can't come up with another idea which constellation reproduces the issues mentioned here and in #973. So I know what causes the failure described there and this PR fixes it. |
Could you try: yield 'array value' => [
[
stdClass::class => [
'dummy' => [
'foo' => 'bar',
],
'another_dummy' => [
'dummies' => '[@dummy, @dummy, @dummy]',
],
],
],
[
'parameters' => [],
'objects' => [
'dummy' => $dummy = StdClassFactory::create([
'foo' => 'bar',
]),
'another_dummy' => StdClassFactory::create([
'dummies' => [$dummy, $dummy, $dummy]
]),
],
],
]; or: yield 'array value' => [
[
stdClass::class => [
'dummy' => [
'foo' => 'bar',
],
'another_dummy' => [
'dummy' => '<randomElement([@dummy, @dummy, @dummy])>',
],
],
],
[
'parameters' => [],
'objects' => [
'dummy' => $dummy = StdClassFactory::create([
'foo' => 'bar',
]),
'another_dummy' => StdClassFactory::create([
'dummy' => $dummy,
]),
],
],
]; without your patch first to see it if makes it fail and then with your patch to see if it solves the issue? |
Nice the first one works. Fails without my change and passes with my change. 👍 I just pushed it into this branch. |
Thanks! |
I had the problem that references in an array:
were correctly recognized but never resolved to a
User
object but stayed as a reference object in the data structure. This PR fixes this.