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
Drupal\Tests\taxonomy\Functional\EfqTest
doesn't make any HTTP request.
Proposed resolution
- Convert it to a kernel test.
- Move
TaxonomyTestTrait
fromtests/src/Functional
totests/src/Traits
as is used by all kind of tests. - Rename it to a more meaningful name.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
N/A
Comment | File | Size | Author |
---|---|---|---|
#17 | 3041030-17.patch | 13.65 KB | Krzysztof Domański |
#17 | interdiff-13-17.txt | 648 bytes | Krzysztof Domański |
#13 | 3041030-13.patch | 13.02 KB | Krzysztof Domański |
#13 | interdiff-10-13.txt | 2.73 KB | Krzysztof Domański |
#10 | 3041030-10.patch | 13.47 KB | claudiu.cristea |
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
jibranI'm pretty sure we can't do that without a BC layer.
Comment #4
claudiu.cristeaComment #5
claudiu.cristea@jibran, you're right. Here's the BC layer.
Comment #6
claudiu.cristeaFixed coding standards.
Comment #7
LendudeJust some notes, nothing blocking I think.
Not strictly necessary since it's updating a class that is deprecated itself.
See #3024461: Adopt consistent deprecation format for core and contrib deprecation messages for the new way of writing these, since this has not been officially approved, not setting it back now (but might have to update this is that lands first)
Went through the conversion and everything checks out.
The only part I'm missing that is mentioned in the IS is: "Rename it to a more meaningful name", which I think is worth doing.
Comment #8
claudiu.cristea#71, 2: Fixed.
The test class has been renamed from
EfqTest
toTaxonomyTermEfqTest
:Comment #9
LendudeAh ok, I was looking for hopefully getting rid of 'Efq', why not just say TaxonomyTermEntityFieldQueryTest. No need to wrack my brain thinking what 'Efq' would stand for.
Comment #10
claudiu.cristeaGot it. In fact the "entity field query" is an antiquity from D7. It's simply "entity query" now.
Comment #11
Krzysztof DomańskiCan we also change the name of the method
testTaxonomyEfq()
totestTaxonomyEntityQuery()
?core/modules/taxonomy/tests/src/Kernel/TaxonomyTermEntityQueryTest.php:31:
Comment #12
BerdirI'd suggest testTermEntityQuery then, possibly for the class name also leave out the Taxonomy.
Comment #13
Krzysztof Domański1. I changed trigger_error() message. Drupal core deprecation policy.
According to #12:
2. I changed the class name from
TaxonomyTermEntityQueryTest
toTermEntityQueryTest
.3. I changed the name of the method
testTaxonomyEfq()
totestTermEntityQuery()
Comment #14
LendudeThanks for all the feedback, this reads much better now.
Nice conversion, no loss of coverage that I can see.
Comment #16
LendudeNew deprecation introduced due to #3042640: Convert TaxonomyFieldTidTest to a kernel test.
Comment #17
Krzysztof DomańskiComment #18
claudiu.cristeaThe patch has been RTBCed in #14. I'm doing it only for the change from #17.
Comment #19
catchCommitted 6874218 and pushed to 8.8.x. Thanks!
Comment #22
dwwFYI: The change record for this was never published. I just did so.
I also figured out how to get my contrib tests that were trying to use this trait to work on 8.7.x and 8.8.x and above, so I added that wisdom to the CR:
https://www.drupal.org/node/3041703/revisions/view/11349728/11635421
Enjoy,
-Derek