Closed
Description
Preconditions (*)
- Magento 2.4
Steps to reproduce (*)
- Attempt to plugin to
\Magento\TwoFactorAuth\Observer\ControllerActionPredispatch::execute
will not work due to \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch being a preference of it - Attempt to plugin to \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch will work in dev mode as interceptors are generated on the fly
- Switch to production mode and run
setup:di:compile
- No interceptor is generated for
\Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch
becuase it has<VENDOR_MODULE>/Test
in its filepath (excluded in\Magento\Setup\Module\Di\Code\Reader\ClassesScanner::extract
)
Expected result (*)
- should be able to plugin to
\Magento\TwoFactorAuth\Observer\ControllerActionPredispatch::execute
Actual result (*)
- Unable to plugin to method due to preference
Suggested solution
- Migrate the
\Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch
preference to be a plugin keeping the\Magento\TwoFactorAuth\Observer\ControllerActionPredispatch
interceptor in play