Issue: When attempting to test a plugin "after" method with $objectManager->create('Shopgate\Base\Model\Config')->startup()
, the original startup()
method is called but not my plugins afterStartup()
Steps Taken:
- [✔] Confirm module enabled & loaded
- [✔] Clear cache with
magento cache:clean config
- [✔] Empty generated code with
rm -r generated/*
- [✔] Register plugin as shown below:
In my etc/di.xml
, I have the following:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Shopgate\Base\Model\Config">
<plugin name="bugFixEnableGetSettings" type="MoninGlobal\ShopgateBugfix\Plugin\ShopgateConfig" sortOrder="9999" />
</type>
</config>
In MoninGlobal\ShopgateBugfix\Plugin\ShopgateConfig
I have:
public function afterStartup($subject, $result){
var_dump(get_class($subject));
var_dump($result);
return $result;
}
The same occurs when using get()
instead of create()
on the object manager.
Any insight into what I am missing here would be greatly appreciated.