Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This is part of #1446366: [meta] Multiple web test classes mislabeled as unit tests. simpletest ([Web|Unit|DrupalUnit]TestBase)
Wrong named classes were found using grep.
$ grep -r 'extends WebTestBase {' modules
SimpleTest WebTestBase classes don't fulfill tests coding standards https://www.drupal.org/node/325974. The definition is now closed, so we can rename according that.
Proposed resolution
- Do a new search of simpletests classes that don't fulfill coding standards.
- Rename the classes and files that don't fullfil standards.
Remaining tasks
- Rename the classes and files that don't fullfil standards.
User interface changes
No.
API changes
No.
Comment | File | Size | Author |
---|---|---|---|
#19 | interdiff-1847280.12.19.txt | 1 KB | YesCT |
#19 | simpletest-webtest-mislabeled-1847280-19.patch | 1.78 KB | YesCT |
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedNote the tests coding standards page is out of date and could use updating #1869794: Update tests coding standards doc and make consistant with 1354 where appropriate
Comment #2
YesCT CreditAttribution: YesCT commentedthey will have a use like:
use Drupal\simpletest\WebTestBase;
Comment #2.0
YesCT CreditAttribution: YesCT commentedchange a C in UnitTestCase to B as in simple test UnitTestBase. it's talking aout 974, so that is simple test stuff.
Comment #5
betoscopioParent issue added.
Comment #6
YesCT CreditAttribution: YesCT commentedI dont remember what I was talking about in #2. :) We are working on this at a sprint together.
Comment #7
betoscopioUpdating summary, doing a new search of wrong named files.
Comment #8
betoscopioComment #9
betoscopioI have done a complete new search with grep finding wich are the subclasses of WebTestBase.
Inside the /core directory a looked using this:
Then I got this full list of subclasses of WebTestBase
Looking for wrong named classes/files I found these:
Also I made a search among all the classes here that are base classes, then among all of these I got one result from the resulting subclasses:
Comment #10
betoscopioRenaming these classes:
The other missnamed file has its own issue #2426323: Rename UserAccountLinksTests to UserAccountLinksTest.
Comment #11
betoscopioI'm uploading a new patch renaming the classes LanguageBrowserDetectionUnitTest, BlockTemplateSuggestionsUnitTest.
The class TermUnitTest can't be renamed, because TermTest already exists. This function should be renamed or take another action to this file fulfill the tests code standards.
Comment #12
betoscopioThe diff was made wrong, reuploading the patch.
Comment #13
betoscopioComment #14
daffie CreditAttribution: daffie commentedLooks good to me.
This is about tests and that is allowed for beta-changes.
Good work @betoscopio.
Comment #15
alexpottCan we change this to a KernelTestBase test whilst we are changing this.
Also can we get a followup to change TermUnitTest to a KernelTestBase test by moving createTerm and createVocabulary to a trait. This followup should also rename the test.
Comment #16
YesCT CreditAttribution: YesCT commenteddoing that.
Comment #17
YesCT CreditAttribution: YesCT commented@alexpott made the issue #2431477: make TermUnitTest a KernelTestBase by moving createTerm and createVocabulary to a trait
Comment #19
YesCT CreditAttribution: YesCT commentedsince that is more than just renaming, lets fix the name here, and change it in #2432647: Convert BlockTemplateSuggestionsTest into a KernelTestBase
should be "Contains \Drupal" not "Contains of Drupal..."
https://www.drupal.org/node/1354#file
---
did that.
(git diff --color-words is helpful in cases like this)
Comment #20
daffie CreditAttribution: daffie commentedLooks good to me.
Comment #21
webchickLooks good. Sub-issue spun off for Alex's question.
Committed and pushed to 8.0.x. Thanks!