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:

  1. 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()'.
  2. 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

Command icon 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

peri22 created an issue. See original summary.

peri22’s picture

Status: Active » Needs review

The 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.

joelpittet changed the visibility of the branch 3618817-rest-tests-fail to hidden.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

It 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.

joelpittet’s picture

joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Thanks @peri22 this puts a big dent in the test failures! Like 50 (from my count of "failure" in the gitlab-ci)! 🙌

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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