[META] Clean up comment module tests and decouple from node

Created on 22 November 2012, over 12 years ago
Updated 16 May 2025, 3 months ago

Problem/Motivation

This is a followup for #731724: Convert comment settings into a field to make them work with CMI and non-node entities and #1812034: Only use standard profile where necessary in comment.module tests (10% bot speed-up) .

Currently, the comment module tests are slow, bloated, fragile, and tightly coupled.

Proposed resolution

Once comment is decoupled from node, we can clean up the existing tests. Tasks:

  • Use more unit tests.
  • Use more API calls instead of performing every single CRUD operation through the UI.
  • Use test entities instead of nodes for testing basic comment functionality.
  • Remove the Views dependency added in #1806334: Replace the node listing at /node with a view from CommentNewIndicatorTest and CommentLinksTest, and test comment teaser rendering with a test implementation or direct API call instead of the frontpage node listing. (See #1847554: Decouple SummaryLengthTest from the node frontpage (and make it a bit faster) .)
  • Use a proper xpath to check for the rendering of specific comments or comment elements instead of the weird regex in CommentTestBase::commentExists(). (See CommentThreadingTest::assertParentLink() for an example.)
  • Remove all the unnecessary debug() stuff.

Remaining tasks

This can happen later, and it doesn't make much sense to do it before #731724: Convert comment settings into a field to make them work with CMI and non-node entities , since that issue has already resolved its test failures. We can file individual issues for the above tasks then.

📌 Task
Status

Postponed: needs info

Version

11.0 🔥

Component

comment.module

Created by

🇺🇸United States xjm

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024