A good testing framework for a module will include several tests over many files. Currently for web functional tests there is just one file with all of the tests. To scale to a larger number of tests it would be nice to split out the general functionality to a place where tests in different files will be able to use them. It's common to create a class that extends WebTestBase for this and then extend that class, but it would be nice to be able to be able to make some tests for #2614292: Add normalizers for Field Collection Items (to enable REST/JSON API support) which may work better if we can extend RESTTestBase instead. For this reason creating a trait for the general field collection test functionality may work better.
Comments
Comment #2
jmuzz commentedIt turns out using traits for this is being done in core already, so it's probably not a bad idea.
/core/modules/comment/src/Tests/CommentTestTrait.php
Comment #4
jmuzz commented