- Issue created by @smustgrave
- πΊπΈUnited States smustgrave
This was smaller then I thought so may be good to go now
- π¨πSwitzerland berdir Switzerland
I find it suspicious that \Drupal\Tests\node\Kernel\NodeTokenReplaceTest::testNodeTokenReplacement doesn't need a change. That probably works because it never reloads the node, so the summary is set as an undefined property and the token works.
- πΊπΈUnited States smustgrave
With regards to TextWithSummaryCreationTrait I did make that before I started fixing tests but shouldn't we offer a replacement for those who may have been relying on createBodyField to make a text_with_summary?
- π¨πSwitzerland berdir Switzerland
> those who may have been relying on createBodyField to make a text_with_summary?
createBodyField was introduced in π Deprecate node_add_body_field() Active , as a replacement for node_add_body_field(), that's a non-issue, but you can of course ask the same question about node_add_body_field(). But that's not really a problem IMHO. There are going to be very, very few cases that specifically want a summary field. We'd need to deprecate and move this trait again to text_with_summary module, and then those contrib module would need to depend on that.
In all my contribs in my project, I see 7 calls or so to node_add_body_field(), I doubt any of them care about the summary. In contrast to that, there are 200+ calls to FieldStorageConfig::create() where tests set up their own fields explicitly. Which I think is where we want to go.
Same with core really, I don't even see any calls to createBodyField() except the one in createContentType(). Maybe there were and we refactored them away in that issue and shouldn't have introduced that trait and method at all? Core has 400+ FieldStorageConfig::create() calls where it sets up specific fields with specific configuration. We keep the concept of a "body" field being a default thing of a node type in tests while removing this on actual sites, that should IMHO be an intermediate step just to deal with the amount of tests relying on it for one reason or another.
Instead, what I think we should do is introduce an API version of \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIAddNewField(). That uses the UI, but most cases don't actually want to test the UI with this, they just want a field with a given name, type and configuration for their entity type.
- πΊπΈUnited States smustgrave
Fair enough, I pushed the changes up but this will actually be postponed on π Stop automatic storage creation of body field Active , added the code that will have to be un-commented out once that lands