Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It's a follow-up from #1781372-113: Add an API for listing (configuration) entities
Introduced API uses sorting of config entities which throws notice when weight of items are equal
More background from #1552396-72: Convert vocabularies into configuration
Thats caused by https://bugs.php.net/bug.php?id=50688 and language_manager that is not initialized in drupal_container()
Related issues
#1893442: Move BlockStorageController::loadByProperties() into ConfigStorageController
#1981418: Drop taxonomy_vocabulary_sort() - we still have @todo in code pointing to this issue
Comment | File | Size | Author |
---|---|---|---|
#24 | 1799600-24.patch | 5.96 KB | damiankloip |
#22 | interdiff.txt | 1.18 KB | andypost |
#22 | 1799600-sorttest-22.patch | 5.95 KB | andypost |
#18 | 1799600-config-list-test-18.patch | 5.82 KB | andypost |
#17 | interdiff.txt | 2.33 KB | andypost |
Comments
Comment #1
andypostJust added a weight for test config entity and test that shows exception
Comment #3
tim.plunkettTagging.
Comment #4
andypostHere's patch with test, suppose the issue was fixed with sorting removal for keys
Comment #5
sunNot all config entities need a weight - this property needs to go into individual config entity classes.
Comment #7
sunSorry, my comment in #5 was completely off — I misinterpreted the affected files.
That said, I still do not understand what exact bug this issue tries to fix. The information provided in this issue so far does not clarify either. The issue summary should be updated to precisely state what's wrong and under which circumstances a PHP notice is triggered.
Comment #8
andypostHere's a re-roll of test.
The purpose of the patch to show that sorting/comparison of 2 config entities throws warning, Proper fix probably depends on php version
Comment #10
andypostIt looks like now sorting is no more issue, test passed locally. But I think it's better to include this test because config entity has ConfigEntityBase::sort() method that is not covered by tests yet, the same applies to ConfigEntityListController::load which calls sort()
Comment #11
andyceo CreditAttribution: andyceo commented#10: 1799600-config-list-test-10.patch queued for re-testing.
Comment #13
andypost#10: 1799600-config-list-test-10.patch queued for re-testing.
Comment #14
tim.plunkettComment #15
aspilicious CreditAttribution: aspilicious commented#10: 1799600-config-list-test-10.patch queued for re-testing.
Comment #16
damiankloip CreditAttribution: damiankloip commentedAlways a big fan of more test coverage :)
Would this be better with an assertIdentical($actual, $expected) to test the array order (maybe just test array keys of the actual against an expected order array)? Maybe we should add another entity to the mix too that has a lower weight than these two, then we are not just covering equal weights.
Might as well call the label() method here?
Not really a fan of using the index here, maybe assertLinkByHref instead? Same goes for the changes to the delete assertions.
Is this in relation to others? only when we list it, otherwise I would just call this 'The weight of the configuration entity'. Do we just use
@var int
too?Comment #17
andypostChanges with #16
Comment #18
andypostre-roll
Comment #20
andypost#18: 1799600-config-list-test-18.patch queued for re-testing.
Comment #21
dawehnerThis is looking great so far.
Do you know whether there should be used the storage controller directly to create the entities in the test? This would make it easier to convert it to unit tests at some point.
It would be great to refer somehow to ConfigEntityBase::sort(), as that's what is tested here. That's just easier for people to figure out what's done here. What do you think about a custom assertion message?
I know the other form elements don't mark the title as translatable, but shouldn't that be done?
Comment #22
andypost1) fixed
2) We are testing that load() returns in right order
3) we never use t() in testing modules
Comment #24
damiankloip CreditAttribution: damiankloip commentedRerolled.
Comment #25
dawehnerignore comment.
Comment #26
andypost@dawehner I cant rtbc my patch :( bot is happy
Comment #27
damiankloip CreditAttribution: damiankloip commentedI think I can... I only rerolled it.
Comment #28
alexpottCommitted cbb579b and pushed to 8.x. Thanks!
Comment #29.0
(not verified) CreditAttribution: commentedUpdated issue summary.