- Issue created by @pdureau
- Assigned to oldeb
- 🇧🇪Belgium oldeb Namur 🇧🇪
If possible, fix an issue in LinksPropTypeNormalizationTest where 2 tests where disabled (commented) because they need the service container:
If you need the service container then you need a KernelTest instead of a UnitTest.
Should I change the whole test class into a KernelTest or should I split the it into 2 tests (1 unit test and one kernel test) ?
- Status changed to Needs work
4 months ago 2:15pm 23 August 2024 - 🇫🇷France pdureau Paris
Should I change the whole test class into a KernelTest or should I split the it into 2 tests (1 unit test and one kernel test) ?
Single KernelTest. Maybe all 3 tests can become kernel tests (to keep them in the same folder)
- 🇧🇪Belgium oldeb Namur 🇧🇪
The issue in fact is that the container is called from a static method which is not aware of the container.
What I think we should do :
- move the fixutres data (current static functions) to yaml files
- avoid calling the Url class in the fixtures data (if possible)
- call the Url class dynamically in the test method (if required)
- mock the pathValidator service
- 🇫🇷France pdureau Paris
- 🇫🇷France pdureau Paris
Postponed because I am doing that first 💬 [2.0.0-beta3] InvalidComponentException: [attributes] String value found, but an object is required in ComponentValidator->validateProps() Postponed: needs info and introduce the unit tests for URL, Attributes, and many other prop types.
So, this ticket will keep the following tasks
- Slot tests
- Move stuff to kernel tests and/or mock services
- 🇫🇷France pdureau Paris
There are 3 unit tests:
- AttributesPropTypeNormalizationTest.php
- LinksPropTypeNormalizationTest.php
- UrlPropTypeNormalizationTest.php
However, they don't cover everything because of limitation of Unit tests. For example:
- AttributesPropTypeNormalizationTest is avoiding testing the render service.
- LinksPropTypeNormalizationTest is avoiding testing TranslatableMarkup & URL
Also, we need tests for
SlotPropType::normalize()
- 🇫🇷France pdureau Paris
Mikael, because you have added
tests/src/Kernel/PropTypesNormalizationTest.php
in beta6Do we still need?
- tests/src/Unit/PropTypeNormalization/AttributesPropTypeNormalizationTest.php
- tests/src/Unit/PropTypeNormalization/LinksPropTypeNormalizationTest.php
- tests/src/Unit/PropTypeNormalization/UrlPropTypeNormalizationTest.php
Can we consolidate those in a single collection of kernel tests?
Mikael's answer:
we can consolidate those tests yes and refactor. better to keep as kernel, and continue what i have introduced if possible. the file EnumNormalizationTest has been deleted, or should have been.
Can we have a
tests/src/Kernel/PropTypeNormalization/
folder, with one file per prop type? a bit like what I did intests/src/Unit/PropTypeNormalization
? - 🇫🇷France just_like_good_vibes PARIS
just_like_good_vibes → changed the visibility of the branch 3469665-test-proptypeinterfacenormalize to hidden.
- 🇫🇷France just_like_good_vibes PARIS
did some massive work over there, please review :)
i think we should improve two prop types : ListPropType and NumberPropType.
A the moment, their normalization is not strong enough imho.let's tackle this in separate tickets.
- 🇫🇷France pdureau Paris
OK for me to be merged.
However, some tests are still commented:
// "Standardized structure, flat, with objects" => // self::standardizedFlatObjects(), ... // "Menu, as generated by the Menu module" => self::menu(),
https://git.drupalcode.org/project/ui_patterns/-/blob/cb853ea951afe89b24...
It would be great to uncomment before merging
-
pdureau →
committed 4ff25e45 on 2.0.x authored by
just_like_good_vibes →
Issue #3469665 by just_like_good_vibes, pdureau: Test PropTypeInterface...
-
pdureau →
committed 4ff25e45 on 2.0.x authored by
just_like_good_vibes →