Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
rest.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 Feb 2026 at 07:23 UTC
Updated:
31 Mar 2026 at 08:55 UTC
Jump to comment: Most recent
There are 143 content entity REST tests in core, and each one tests GET, POST, PATCH and DELETE as individual methods. Each of these methods requires a separate Drupal install in the test.
If we combine these four test methods into one, we save 3 installs per test. On my machine this cuts a single test class down from 40 seconds to 24 seconds. In total this should cut out 429 installs in a full test run.
Run e.g. UserJsonCookieTest
Combine the test methods.
Clean up after each method so the next method can run without a full reinstall.
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 #3
longwaveComment #4
longwave#3572055: Fix skip for unsupported methods on REST tests also will help speed up these tests.
Comment #5
catchThis looks really encouraging. I think I tried something similar at some point but balked at the need to tear down after each protected method, but what's here is pretty minimalist vs. the time saving. Can't see anything to complain about so RTBC for me.
Comment #6
alexpottAs we're changing test base classes I checked out contrib and couldn't find anywhere that this change was going to cause failures but I'd be very surprised if this change doesn't break a contrib or custom test somewhere. This feels an impossible change to make in a 100% BC manor - other than creating completely new test base classes to extend which I don't think is warranted here given what I've seen in contrib. Perhaps a change recrod with suffice.
Comment #7
catchAdded a CR https://www.drupal.org/node/3578858
Comment #8
alexpottComment #9
godotislateOne minor question on the MR.
Comment #12
godotislateCommitted a4b46f3 and pushed to main. Thanks!
Did not apply to 11.x, so need a backport MR.
Comment #14
alexpottI was merging at the same time. The conflicts were simple to resolve so I did.
Committed 93bc0d9 and pushed to 11.x. Thanks!
I resolved the 11.x conflict during merge.
Comment #17
alexpottWell that was overly confident. @godotislate was correct to ask for a backport MR.
Comment #18
alexpottPesky tests we'd removed due to the contact module being removed...
Comment #20
smustgrave commented11.x appears to be passing.
Comment #22
catchCommitted/pushed to 11.x, thanks!