Skip to content

Commit daf4a5f

Browse files
authored
Fix integration test issue with interceptor
I have seen the following error: ``` Property Magento\TestFramework\App\Config\Interceptor::$data does not exist ``` This is because `\Magento\TestFramework\Store\StoreManager::reinitStores` does not take into account that \Magento\TestFramework\App\Config as returned from the ObjectManager might just as well be a `\Magento\TestFramework\App\Config\Interceptor`, in case a plugin on that class exists for example. To be able to still get the data that is needed for the test, there is the need to test for the implementation of \Magento\Framework\Interception\InterceptorInterface and get the $data property from the parent.
1 parent b9101b1 commit daf4a5f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dev/tests/integration/framework/Magento/TestFramework/Store/StoreManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\TestFramework\Store;
77

8+
use Magento\Framework\Interception\InterceptorInterface;
89
use Magento\TestFramework\App\Config;
910
use Magento\TestFramework\ObjectManager;
1011

@@ -128,6 +129,9 @@ public function reinitStores()
128129
//In order to restore configFixture values
129130
$testAppConfig = ObjectManager::getInstance()->get(Config::class);
130131
$reflection = new \ReflectionClass($testAppConfig);
132+
if ($reflection->implementsInterface(InterceptorInterface::class)) {
133+
$reflection = $reflection->getParentClass();
134+
}
131135
$dataProperty = $reflection->getProperty('data');
132136
$dataProperty->setAccessible(true);
133137
$savedConfig = $dataProperty->getValue($testAppConfig);

0 commit comments

Comments
 (0)