You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GromNaN
changed the title
Aggregation classes are final and can't be mocked to mock Aggregation\BuilderAggregation class is final and can't be mocked to mock Aggregation\BuilderNov 17, 2024
Bug Report
Summary
The method
Doctrine\ODM\MongoDB\Aggregation\Builder::execute()
is deprecated and should be replaced by$builder->getAggregation()->getIterator()
(Note that it's more verbose for the common use case).But
getAggregation()
must return an instance ofDoctrine\ODM\MongoDB\Aggregation\Aggregation
. This class is hard to instantiate in tests as it requires a lot of dependencies that would have to be mocked with the ODM internal behavior. Since the class isfinal
, it cannot be mocked.I created a draft PR to remove usage of
Aggregation\Builder::execute()
in API Platform, but the tests cannot be fixed. GromNaN/api-platform-core#2The solutions would be to remove the
final
keyword onDoctrine\ODM\MongoDB\Aggregation\Aggregation
.The text was updated successfully, but these errors were encountered: