[BUGFIX] Ensure deterministic orderBy of CategoryCollection
Missing deterministic orderBy for database queries leads to different records retrieved across dbms and dbms version. Some major dbms tends to order by primary key implictly, where in newer versions it behaves differently. Even if the database structure and data seems to look identically, dbms tends to handle it in different ways. Test fixtures for CategeoryCollectionTests do not provide any values for sorting. Inserting the data to the database is done through plain database inserts through the testing framework, not taking care of table specific sorting fields if test data missing them, which DataHandler and RelationHandler takes care of in the core. There can be instances with extensions omitting the usage of datahandler and as such inserting nondeterministic datasets, deterministic queries must be implemented. Retrieving related records for categories has been missing the required sorting field, so sorting was unreliable. Ensuring deterministic record retrieval by adding 'uid_foreign' as last orderBy to kick in if two records have the same sorting value. This allows activation of a CategoryCollection related functional test with postgres. Even though the test data misses proper sorting field values, this is not changed to ensure deterministic sorting does not break again. This patch acts as follow up for #95061. $ Build/Scripts/runTests.sh -s functional -d postgres \ typo3/sysext/core/Tests/Functional/Category/Collection/\ CategoryCollectionTest.php Resolves: #95091 Related: #95061 Releases: master, 10.4 Change-Id: I9feec421ff9628aabe100fbab9a69c570b9dd029 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70877 Tested-by:core-ci <typo3@b13.com> Tested-by:
Jochen <rothjochen@gmail.com> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Jochen <rothjochen@gmail.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/core/Classes/Category/Collection/CategoryCollection.php 9 additions, 1 deletion...t/core/Classes/Category/Collection/CategoryCollection.php
- typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php 0 additions, 2 deletions...Functional/Category/Collection/CategoryCollectionTest.php
Please register or sign in to comment