- Issue created by @tedbow
- Assigned to abhisekmazumdar
- Merge request !313#3462160: Create a new Exception type for a dynamic prop missing a host entity → (Merged) created by abhisekmazumdar
- 🇮🇳India abhisekmazumdar India
I'm working on fixing the test case before moving it for review.
- Issue was unassigned.
- Status changed to Needs work
4 months ago 8:55am 18 September 2024 - 🇮🇳India abhisekmazumdar India
Test cases are not my friend. Can someone either fix them or provide me with input on why all the test cases are complaining about the new exception not being found?
https://git.drupalcode.org/issue/experience_builder-3462160/-/jobs/27664...
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Looks like the provider for
\Drupal\Tests\experience_builder\Kernel\Config\DefaultFieldValueTest::testDefaultFieldValue()
also must be updated? - 🇮🇳India abhisekmazumdar India
I don't understand the error for: https://git.drupalcode.org/issue/experience_builder-3462160/-/jobs/28517...
Can someone provide feedback or fix this ?
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
It quite literally says what the problem is:
OutOfRangeException: No props sources stored for dynamic-static-card4. Caused by either incorrect logic or `props` being out of sync with `tree`.
So if you look for remaining
throw new \OutOfRangeException
, you'll find:if (!array_key_exists($component_instance_uuid, $this->propsValues)) { throw new \OutOfRangeException(sprintf('No props sources stored for %s. Caused by either incorrect logic or `props` being out of sync with `tree`.', $component_instance_uuid)); } …
So, the error message then points to a hitherto masked defect in the following test case that was being papered over until this change:
'missing components, using dynamic props' => [ [ 'tree' => self::encodeXBData([ ComponentTreeStructure::ROOT_UUID => [ ['uuid' => 'dynamic-static-card2df', 'component' => 'sdc_test+missing'], ['uuid' => 'dynamic-static-card3', 'component' => 'sdc_test+missing-also'], ['uuid' => 'dynamic-static-card4', 'component' => 'xb_test_sdc+props-slots'], ], ]), 'props' => self::encodeXBData([ 'dynamic-static-card2df' => [ 'heading' => [ 'sourceType' => 'dynamic', 'expression' => 'ℹ︎␜entity:node:article␝title␞␟value', ], ], 'dynamic-static-card3' => [ 'heading' => [ 'sourceType' => 'dynamic', 'expression' => 'ℹ︎␜entity:node:article␝title␞␟value', ], ], ]), ], ],
You can see that there's only an entry in
props
for 2 of the 3 component instances. So we just need to add the missing 3rd :) - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Hah, looks like https://git.drupalcode.org/project/experience_builder/-/merge_requests/3... confirms my hunch in #14!
-
tedbow →
committed 978514cd on 0.x authored by
abhisekmazumdar →
Issue #3462160 by abhisekmazumdar, wim leers, tedbow: Create a new...
-
tedbow →
committed 978514cd on 0.x authored by
abhisekmazumdar →
- 🇺🇸United States tedbow Ithaca, NY, USA
🎉Thanks @abhisekmazumdar and @wim leers
- 🇺🇸United States tedbow Ithaca, NY, USA
Since the remaining case is a pretty rare case to be practical lets at least postpone it on 📌 Refactor the XB field type to be multi-valued, to de-jsonify the tree, and to reference the field_union type of the prop values Active because this might stop us from having to adapt the test case after we have made it. Can just make it 1 time, if we determine it is still needed, after things are more settled.