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
assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#11 | 3126969-11.patch | 4.35 KB | mondrake |
#11 | interdiff_7-11.txt | 4.75 KB | mondrake |
Comments
Comment #2
mondrakeIMO we can just drop those assertions that are just checking implementation details (the injection of services)
Comment #3
longwaveAgree, this is not testing anything useful.
Comment #4
alexpottWell this is testing the setter injection in \Drupal\Core\Entity\EntityTypeManager::createHandlerInstance().
I think we could make the $moduleHandler and$stringTranslation properties public in the test classes and test them.
Comment #5
mondrakeDifferent approach, with getters in the test classes.
Comment #6
mondrakeComment #7
mondrakeComment #8
daffie CreditAttribution: daffie commentedAll instances of
assertAttributeInstanceOf()
have been replaced.The creation of the class
TestEntityHandlerBase
has been done to test testGetHandler().The classes
TestEntityForm
andTestRouteProvider
have 2 extra method for testing.The removal of suppressing of the warning for assertAttributeInstanceOf() makes sure that all instances have been removed.
All code changes look good to me.
For me it is RTBC.
Comment #9
alexpottSo the reason I suggested making the params public rather than adding methods is for the following reasons
1. We closer to the original tests without adding functionality.
2. The documentation can be
3. We don't have to ponder why you've overridden \Drupal\Core\StringTranslation\StringTranslationTrait::getStringTranslation() and not
\Drupal\Core\Entity\EntityHandlerBase::moduleHandler()
4. And if the upstream signatures change we do't have to worry about anything.
I should have documented this before.
Comment #10
mondrakeMmm yea. I missed that you can extend classes and change visibility of properties.
Comment #11
mondrakeHere we go.
Comment #12
longwaveLooks good.
Comment #15
alexpottCommitted and pushed de981ef81e to 9.1.x and de686a9327 to 9.0.x. Thanks!
Comment #16
alexpott