Problem/Motivation
Part of #3529510: [meta] Add return types to test traits
Add return type hints to these traits that create something.
- core/modules/image/tests/src/Kernel/ImageFieldCreationTrait.php
- core/modules/media/tests/src/Traits/MediaTypeCreationTrait.php
- core/modules/node/tests/src/Traits/ContentTypeCreationTrait.php
- core/modules/node/tests/src/Traits/NodeCreationTrait.php
Steps to reproduce
Add SlevomatCodingStandard.TypeHints.ReturnTypeHint to phpcs.xml.dist
Proposed resolution
Add return type hints for the selected files.
Remaining tasks
Resolve failing tests in WorkspacesContentModerationStateTest
Review
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3644372
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
quietone commentedComment #4
quietone commentedComment #5
quietone commentedThere are failing tests in WorkspacesContentModerationStateTest with the error
The "node_type" entity type can only be saved in the default workspace..How to resolve that?
Comment #6
godotislateWorkspacesContentModerationStateTestextendsContentModerationStateTest, so anytest*in the parent class that aren't overridden by the child class get run as part of the child class. If any of those methods callcreateContentType(), since it is no longer overridden, it is not executing correctly outside of a workspace anymore.