Review main Merged

87351[TASK] Provide more tests for DataMapFactory

Garvin Hicking CR +2 V +2 Hard +303 −33 updated 12/04/24, 17:26

Commit message

With #105754 it became apparent that test coverage is
lacking for the DataMapFactory to provide column name mapping
for 'ctrl' fields.

The actual "proof" of previously wrong mapped data is now
covered in
`DataMapFactoryTest::customRestrictionFieldsAreMappedWithProperDataMap`.

It checks a newly introduced `blog_example` extension fixture domain
model `RestrictedComment` that uses all existing customizable 'ctrl'
field column names and ensures the data is passed along properly.

When patch #105754 would be reverted, for example via:

```
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
@@ -139,8 +139,8 @@ readonly class DataMapFactory
             deletedFlagColumnName: $schema?->hasCapability(TcaSchemaCapability::SoftDelete)
                 ? (string)$schema->getCapability(TcaSchemaCapability::SoftDelete)
                 : null,
-            disabledFlagColumnName: $schema?->hasCapability(TcaSchemaCapability::RestrictionDisabledField)
-                ? (string)$schema->getCapability(TcaSchemaCapability::RestrictionDisabledField)
+            disabledFlagColumnName: $schema?->hasCapability(TcaSchemaCapability::RestrictionStartTime)
+                ? (string)$schema->getCapability(TcaSchemaCapability::RestrictionStartTime)
                 : null,
             startTimeColumnName: $schema?->hasCapability(TcaSchemaCapability::RestrictionStartTime)
                 ? (string)$schema->getCapability(TcaSchemaCapability::RestrictionStartTime)
```

this test would then fail.

Also, tests are added to the `DataMapperTest` to create and verify
extbase domain models with customized 'ctrl' column field names
can be persisted and retrieved.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 3

Files 7

Review log 1620

  1. Garvin Hicking uploaded patch set 1 12/04/24, 11:07

  2. Garvin Hicking uploaded patch set 2 12/04/24, 11:10

  3. core-ci voted on patch set 1 V -1 12/04/24, 11:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70580

  4. core-ci voted on patch set 2 V -1 12/04/24, 11:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70581

  5. Garvin Hicking uploaded patch set 3 V -1 12/04/24, 11:20

    Happify Stan the man
  6. core-ci voted on patch set 3 V +1 12/04/24, 11:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70582

  7. Benni Mack voted on patch set 3 CR +1 V +1 12/04/24, 11:37

  8. Oli Bartsch voted on patch set 3 CR +1 V +1 12/04/24, 12:18

  9. Oli Bartsch commented on patch set 3 12/04/24, 12:19

    tx_blogexample_domain_model_restrictedcomment.php:35

    Do we really need to define the columns? Usually they should be generated automatically based on ctrl.
  10. Christian Kuhn commented on patch set 3 12/04/24, 15:39

    DataMapperTest.php:621

    asserting a .csv fixture would probably be more convenient here and would omit the need for the querybuilder stuff.
  11. Christian Kuhn commented on patch set 3 CR -1 12/04/24, 15:55

    on it.
  12. Christian Kuhn commented on patch set 3 12/04/24, 16:04

    tx_blogexample_domain_model_restrictedcomment.php:35 Reply

    Done
  13. Christian Kuhn commented on patch set 3 12/04/24, 16:22

    DataMapperTest.php:621 Reply

    Done
  14. Christian Kuhn uploaded patch set 4 CR +1 V +1 12/04/24, 16:28

  15. core-ci voted on patch set 4 V +1 12/04/24, 16:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70599

  16. Christian Kuhn voted on patch set 4 CR +1 V +1 12/04/24, 16:34

  17. Benni Mack voted on patch set 4 CR +1 V +1 12/04/24, 16:35

  18. Oli Bartsch voted on patch set 4 CR +1 V +1 12/04/24, 16:38

  19. Garvin Hicking commented on patch set 4 CR +2 V +2 12/04/24, 17:26

    Thanks all for improving this!
  20. Garvin Hicking merged patch set 5 12/04/24, 17:26