Page MenuHomePhabricator

Improve FactoryArgTestTrait
Closed, DeclinedPublic

Description

In https://gerrit.wikimedia.org/r/#/q/Ifa7d943875f05088ef697a5a18ad292342a9b4ad the following shortcomings of https://gerrit.wikimedia.org/r/#/q/ FactoryArgTestTrait were discovered:

  • getFactoryMethodName composes a default name that consists of new and the class-name. This works great for classes in the main namespace, however, it also includes the namespace of the class. For example for the class MathoidChecker it currently generates the Method name newMediaWiki\Extension\Math\InputCheck\MathoidChecker
  • counting of parameters only works if the ServiceOptions are passed as they are from the factory to the class instance. However, if one extracts the required wgGlobals in the factory and passes them, the parameter counting is confused.

See https://gerrit.wikimedia.org/r/#/q/Ifa7d943875f05088ef697a5a18ad292342a9b4ad for details

Related Objects

Event Timeline

Physikerwelt triaged this task as Medium priority.

Thanks for filing the task. Please leave a note in the new InputCheckFactoryTest file to reference this bug

Done. I also added the CPT tag so that the task is triaged.

Aklapper removed a project: good first task.

@eprodromou: A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor. It's unclear to me if this requires changes in mediawiki/extensions/Math or mediawiki/core as no project tag has been assigned, hence I'm removing the good first task tag. Please add details what exactly has to happen where and how for a new contributor, and then add back the good first task project tag. Thanks a lot in advance!

FactoryArgsTestTrait is already too much magic, let's not make it more magical. If more needed then it provides - just write the code.