Unit tests for PropExpressions to go to/from string representation + single StructuredDataPropExpression::from(…) method

Created on 31 May 2024, 4 months ago
Updated 18 June 2024, 3 months ago

Problem/Motivation

It's become clear over the past 24 hours that FieldPropExpression and friends (everything in src/PropExpressions) is hard to grok for people.

Eventually we'll need docs, initially unit tests can serve as docs.

In this first pass, there is one key goal: unit tests to go from PHP object representation to string representation and vice versa should pass β€” because once that's working, contributors won't lose time anymore due to bugs in that low-level foundation. (Which currently still is 99% identical to the PoC from ~1.5 month ago.)

Out of scope: making all code in src/PropExpressions beautiful/elegant/DRY/… β€” the purpose is only the bold bit above, because that A) unblocks other issues/MRs, B) keeps scope tight.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

  • API addition: single StructuredDataPropExpression::from(…) method to avoid if/else logic to invoke the appropriate class-specific method.

Data model changes

  • πŸ₯³ No more mysterious invisible whitespace in the string representation. Result: less frustration, and the sort order in test expectations now actually makes sense.
  • The string representation of Field(Type)ObjectPropsExpression no longer lists the mapped object props separated by , (comma + space), but only by , (comma).
πŸ“Œ Task
Status

Fixed

Component

Page builder

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Documentation

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024