Problem/Motivation
All 18 'Functional\Rest\*Test::testCrud' tests are currently failing on the '3.0.x' branch with current core. There are two independent causes for this:
-
Wrong test base class: The three '*ResourceTestBase' classes currently extend 'EntityResourceTestBase'. The 'testCrud()' method in that base class exercises POST, PATCH, and DELETE operations. However, Facet, FacetSource, and FacetsSummary are config entities, meaning those verbs are not routed. This results in the following test failure:
Failed asserting that 404 is identical to 415.
Core provides 'ConfigEntityResourceTestBase' specifically for this scenario (it only runs GET and HEAD). Switching to this also naturally resolves the old "@todo Update after https://www.drupal.org/node/2300677" notes found in 'getNormalizedPostEntity()'. - XML charset case sensitivity: The nine XML test variants declare a mime type with an uppercase 'UTF-8' charset, but core now sends it in lowercase ('utf-8'). Core's own 'BlockXmlAnonTest' already uses the lowercase value.
Proposed resolution
Switch the three base classes to 'ConfigEntityResourceTestBase' and change the charset to lowercase in the nine XML test classes. This is the exact same fix that turned the REST tests green on the '2.0.x' branch in issue #3552832: Fix broken tests in 2.0.x.
Remaining tasks
Review the MR.
Note: What is NOT in scope for this issue:
The 'FacetsDemoTest::testDemoPage' test also fails due to an unmet config dependency on the node body field storage. This is a different root cause and will be handled in a separate issue.
Issue fork facets-3618817
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:
- 3618817-rest-test-base
changes, plain diff MR !403
- 3618817-rest-tests-fail
compare
Comments
Comment #3
peri22 commentedThe 18 REST failures are completely gone now, those tests are finally passing!
The pipeline is still showing as red on '3.0.x', but I checked and it's because of two unrelated issues:
First, 'HierarchicalFacetIntegrationTest::testWeightSort' is failing because it can't find the term weight status form field. This is a known bug that is already covered in #3618692: Term weight and UID processors are not offered on Drupal 11.4.
Second, 'FacetsDemoTest::testDemoPage' is failing because 'facets_demo' relies on the node body field storage, which core recently moved out of the Standard profile. We'll need a separate issue to fix that demo module dependency.
The rest of the suite is unaffected by this change.
Comment #5
joelpittetIt would be nice to keep the D10 tests working as well... but I will RTBC because I don't know if that is intended and this doesn't affect how it works only tests and only D11.
Comment #6
joelpittetStill RTBC going to relate this to the other fixes in #3618692: Term weight and UID processors are not offered on Drupal 11.4
Comment #8
joelpittetThanks @peri22 this puts a big dent in the test failures! Like 50 (from my count of "failure" in the gitlab-ci)! 🙌