Review main Merged

76122[TASK] Make FormProtectionFactory injectable - part 1

Benni Mack CR +2 V +2 Hard +187 −167 updated 10/20/22, 14:08

Commit message

FormProtectionFactory is hard to mock, and relies
a lot on global state and global variables. The functionality
was built in times for 6.2, so neither PSR-7 (v7+) nor
DI (v10+) was planned.

This is a first patch of a series to change the
behaviour so FormProtectionFactory is fully injectable
via DI.

For this, FormProtectionFactory can now be instantiated,
and can determine the actual protection type by the request
object via the ->createFromRequest() method.

The existing functionality is kept (FormProtectionFactory::get()),
until all places are migrated and the static functionality
can then be deprecated.

This first patch uses DI and the new method "createFromRequest()"
in the installer.

The next patch will then migrate all other places as much as possible
to use DI with a possible - possibly with a "createForType()" method -
where the third patch will deprecate the static methods.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 11