/** * @param \Magento\Framework\App\Cache\Type\Config $configCacheType * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Framework\Simplexml\Element $sourceData */ public function __construct(\Magento\Framework\App\Cache\Type\Config $configCacheType, \Psr\Log\LoggerInterface $logger, \Magento\Sales\Model\Config $salesConfig, $sourceData = null) { parent::__construct($sourceData); $this->_configCacheType = $configCacheType; $this->_logger = $logger; $this->_salesConfig = $salesConfig; }
/** * Clear InstanceManager cache * * @return \Magento\TestFramework\ObjectManager */ public function clearCache() { foreach ($this->_classesToDestruct as $className) { if (isset($this->_sharedInstances[$className])) { $this->_sharedInstances[$className] = null; } } \Magento\Framework\App\Config\Base::destroy(); $sharedInstances = ['Magento\\Framework\\ObjectManagerInterface' => $this, 'Magento\\Framework\\App\\ObjectManager' => $this]; foreach ($this->persistedInstances as $persistedClass) { if (isset($this->_sharedInstances[$persistedClass])) { $sharedInstances[$persistedClass] = $this->_sharedInstances[$persistedClass]; } } $this->_sharedInstances = $sharedInstances; $this->_config->clean(); return $this; }