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
The codebase contains references to the outdated namespace Drupal\*\Tests. These should be updated to Drupal\Tests\*
Steps to reproduce
See for example core/modules/node/tests/modules/node_access_test/node_access_test.module:
- * @see \Drupal\node\Tests\NodeQueryAlterTest
- * @see \Drupal\node\Tests\NodeAccessBaseTableTest
Proposed resolution
Update outdated class references from Drupal\*\Tests to Drupal\Tests\*
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Comment | File | Size | Author |
---|---|---|---|
#7 | 3337653-7.patch | 57.36 KB | Lendude |
| |||
#4 | 3337653-4.patch | 60.24 KB | Lendude |
#3 | 3337653-3.patch | 60.15 KB | Lendude |
|
Comments
Comment #2
LendudeProposed automation:
In PHPStorm do a replace in file
Find with regex:
\\Drupal\\(\w+)\\Tests\\
Replace with :
\\Drupal\\Tests\\$1\\
Comment #3
LendudeLets see if this breaks anything
Tagging for the PHPUnit initiative since we should have changed it then ;)
Comment #4
LendudeLets try that again with the trailing slashes added
Comment #5
idebr CreditAttribution: idebr at iO commentedThe automated replacement is missing the added namespace for `Functional` / `Unit` etc, so it's unlikely this can be automated.
Comment #6
LendudeYeah good point, it does provide a handy list of what needs to be checked I guess.
Comment #7
LendudeManually went through them and added what needed to be added. Reverted a couple that still use the old namespaces (in Views mostly), removed some things that no longer seem to exist
Comment #8
smustgrave CreditAttribution: smustgrave at Mobomo commentedRan this locally and found these instances. Could you confirm if they are no relevant to this