Пример #1
0
 /**
  * Installs user configuration
  *
  * @param \ArrayObject|array $data
  * @return void
  */
 public function installUserConfig($data)
 {
     $userConfig = new UserConfigurationDataMapper();
     $configData = $userConfig->getConfigData($data);
     if (count($configData) === 0) {
         return;
     }
     /** @var \Magento\Config\Model\Config\Factory $configFactory */
     $configFactory = $this->objectManagerProvider->get()->create('Magento\\Config\\Model\\Config\\Factory');
     foreach ($configData as $key => $val) {
         $configModel = $configFactory->create();
         $configModel->setDataByPath($key, $val);
         $configModel->save();
     }
 }
 /**
  * @param array $data
  * @param array $expected
  * @dataProvider getConfigDataDataProvider
  */
 public function testGetConfigData(array $data, array $expected)
 {
     $userConfigurationDataMapper = new UserConfigurationDataMapper();
     $this->assertEquals($expected, $userConfigurationDataMapper->getConfigData($data));
 }