- Issue created by @pdureau
- e0ipso Can Picafort
I think this is in line with the Robustness Principle, and I am in favor.
What happens if a non-string scalar is passed? Do we trigger the error then, do we cast it to a string, or do we find an appropriate render array to use for each scenario?
- 🇫🇷France pdureau Paris
What happens if a non-string scalar is passed? Do we trigger the error then, do we cast it to a string, or do we find an appropriate render array to use for each scenario?
Let's raise the
InvalidComponentDataException
you are currently raising. - Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
about 1 year ago Not currently mergeable. - @pdureau opened merge request.
- last update
about 1 year ago 30,417 pass - @pdureau opened merge request.
- last update
about 1 year ago 30,417 pass - @pdureau opened merge request.
- last update
about 1 year ago 30,417 pass - @pdureau opened merge request.
- 🇫🇷France pdureau Paris
Before doing any modifications, I got some failures from module's tests:
1) Drupal\Tests\sdc\Kernel\ComponentRenderInvalidTest::testInvalidDefinitionModule Failed asserting that exception of type "Drupal\sdc\Exception\InvalidComponentException" is thrown. 2) Drupal\Tests\sdc\Kernel\ComponentRenderInvalidTest::testInvalidDefinitionTheme Failed asserting that exception of type "Drupal\sdc\Exception\InvalidComponentException" is thrown.
Maybe I did something wrong while setting up my phpunit test environement.
Those failures will stay after my modification, so I hope I will not miss a test case.
- last update
about 1 year ago Custom Commands Failed - Status changed to Needs review
about 1 year ago 2:29pm 19 October 2023 - 🇫🇷France pdureau Paris
Hi Mateu,
Here is the merge request: https://git.drupalcode.org/project/drupal/-/merge_requests/5044
I have also updated the
checkInvalidSlot
test:'#slots' => [ - 'banner_body' => 'I am an invalid render array.', + 'banner_body' => new stdClass(), ],
I wanted to use a PHP which is not a render array, but it seems Utilities::isRenderArray() is returning TRUE for any array, not only render array. Am I right? If yes, do we need to fix this too?
- Status changed to Needs work
about 1 year ago 3:07pm 20 October 2023 - last update
about 1 year ago Custom Commands Failed - last update
about 1 year ago 30,438 pass - last update
about 1 year ago 30,438 pass - Status changed to Needs review
about 1 year ago 5:40pm 26 October 2023 - 🇫🇷France pdureau Paris
I pushed a second commit: https://git.drupalcode.org/project/drupal/-/merge_requests/5044/diffs?co...
I hope it is OK now.
- Status changed to RTBC
about 1 year ago 6:07pm 30 October 2023 - 🇺🇸United States smustgrave
Rebased to run test-only feature
There was 1 failure: 1) Drupal\Tests\sdc\Kernel\ComponentRenderTest::testRender Failed asserting that exception message 'Unable to render component "sdc_test:my-banner". A render array is expected for the slot "banner_body" when using the render element with the "#slots" property' contains 'Unable to render component "sdc_test:my-banner". A render array or a scalar is expected for the slot "banner_body" when using the render element with the "#slots" property'. /builds/issue/drupal-3391702/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122 /builds/issue/drupal-3391702/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:55 /builds/issue/drupal-3391702/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 FAILURES! Tests: 2, Assertions: 26, Failures: 1.
Which is good.
The change looks good and matches the proposed solution. Only question I have is even though SDC is experimental will it need a CR for the new way to pass things?
- last update
about 1 year ago Custom Commands Failed - e0ipso Can Picafort
Agreed on the RTBC. I think this improves DX a bit.
Thanks for this!
- First commit to issue fork.
- Status changed to Fixed
about 1 year ago 12:37pm 31 October 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
5 months ago 5:37pm 18 June 2024