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

jmuzz created an issue. See original summary.

jmuzz’s picture

It 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

  • jmuzz committed 02382e9 on 8.x-1.x
    Issue #2760431 by jmuzz: Move setup and helper functions out of...
jmuzz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.