Closed (fixed)
Project:
Drupal core
Version:
9.0.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2020 at 16:36 UTC
Updated:
1 May 2020 at 08:47 UTC
Jump to comment: Most recent, Most recent file
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 commentedAll instances of
assertAttributeInstanceOf()have been replaced.The creation of the class
TestEntityHandlerBasehas been done to test testGetHandler().The classes
TestEntityFormandTestRouteProviderhave 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